开发者

How to prevent a combo box from selecting a value

I'm using a ComboBox with the DropDownStyle = "DropDownList". Programatically I set the DataSource for the items in the list. Something like this :

combo.DisplayMember = "Text";
combo.ValueMember = "id";
combo.DataSource = ds.tbl;
开发者_如何学Python

The list is populated correctly and the first element is selected. How do I prevent the first element from being selected?


combo.SelectedIndex = -1;


Set SelectedIndex to -1. See here: http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.selectedindex.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜