There is no ’ListItem’ in Winforms Combobox
I have been using ASP.Net for years. There is a very popup control, dropdown list. I used this control thousands of times. I know it very well. Recently, I built a winforms application. I need to use a dropdown list. ComboBox Control is the most similar with dropdown list. I found there is a different. I like to add a default option, new ListItem("Please select a type",""), into the items of the control. If the program will check whether the user selects this option, if that is the case, it will treat the input to be null. The items in ComoboBox is ObjectCollection. They are just a list of objects. You cannot use ListItem.
Well, you can create your version of ListItem objects and convert your domain objects into ListItem. Finally, you can bind the list of ListItem objects into the comobobox. In this way, Combobox will works like a drop down list.
I chose to use a simpler approach. I just created a domain object with ID 0 and insert it into the list.
Code
ResourceType empty = new ResourceType(); | |
empty.Name="---------------------------------------"; | |
resourceTypes.Insert(0,empty); | |
ddlSearchResourceTypes.DataSource=resourceTypes; |
WPF vs Winforms
I found I like Winforms Programming more. I felt that is easy to use. I can use TableLayoutPanel to create a complex UI. I know Grid in WPF can do a similar job, but I still think TableLayoutPanel is easier. Maybe, that is because I have been using WinForms for that many years! Moreover, I have experienced WinForms Application is faster. Thus, I like Winforms more.
Microsoft New SQL Server version ,"Denali" CTP3, is released
I got an email from Microsoft about new SQL Server version ,"Denali" CTP3, is released. I read their documents it got more support features in cloud. Moreover, its express version is more focus on localDB. This sounds like a in-process DB. That is very similar with sqlite. I have a look on that to how much improvements they have.
Click here to download from Microsoft
Reference:
SQL Server Code Name "Denali" Cloud On Your Terms
SQL Express
I got System.BadImageFormatException when I was using SQLite
I had built a new application using System.Data.Sqlite. When I run the application, I got an exception, System.BadImageFormatException.Well, I found I was using 64-bit version, because System.Data.Sqlite will call some unmanaged dlls. So, it still needs to be in 32-bit. After I changed to use 32-bit dll,then all goods. Or you can switch your build target to 64 bit and using 64 bit dlls.
Learning Silverlight
I wish to a rich user interface for my website. Well, HTML 5 is the best choice. But HTML 5 is still not easy to do some tasks, such as animations and charting. Then, Flash is the second best choice. A lot of platforms support this. But I need to learn it from scratch. In this case, Silverlight is a much better option. It is similar with WPF which I have learnt before.Moreover, the Silverlight is a component-based components. I can use some third-party controls to build the interface. Those third-party controls can be download from internet freely or just needs to pay a small amount of money. This can reduce the amount of coding. So, I choose to learn Silverlight