Monday, August 6, 2007

A 'feature' of System.Windows.Forms.ComboBox

In a program I maintain, I found a strange behavior of System.Windows.Forms.ComboBox in .Net 1.1. That is, when I dynamically change Combox.SelectedIndex, Combox.SelectedValue returns null. To retrieve 'SelectedValue', I have to use the following code, ComboBox.Items[ComboBox.SelectedIndex][ ComboBox.ValueMember]. Is it a feature or a bug?

No comments: