free hit counter June 2004 - Posts - Nauman Leghari's Blog

June 2004 - Posts

If you missed any of the action from euro2004 then here are the highlights in the form of “Virtual Replay” [BBC]. Here is Lampard scoring against France and you can also view the goals in the injury time ;).

(You need to have Shockwave plugin to view this)

A while back, I was in a situation where I had to assign different values to different items in a combo box, a routine and simple task on desktop. But, as I found out that there is no Value property for the ComboBox control so its not simple as setting the Value property. Anyway, I managed to get around the problem by using the techniques suggested by some brilliant ppl on DOTNETCF list. For future reference, here are the two different methods.

1) Using the Hashtable (by Ben Kloosterman)

He suggested that I use a Hashtable to track individual items of a combobox. The method involves getting a hash id for each combo box item text and add them into the hashtable with the value. And in the end, when I need that value, I can get by using the hash id for the combo box item.

2) Set object in ComboBox Item (by Anders Zangrando Heick)

The thing that I didn't know before is that the ComboBox itself uses the ToString() property of the Item object to display text in the combobox. So, I can set my own object as an item for ComboBox and then overrides the ToString() method to display anything that I want. I think this approach is easier to implement than the first.

The source code is not provided here as these are really very simple methods and you can easily work it out yourself. Otherwise, you can contact me for the source snippet.

If you know any other method then please leave your comments.


More Posts