开发者

Insert data as first item

I have a combobox which binds data from the database. It gets the data correctly but I want the first item I tried but I could not so how can I d开发者_如何学编程o that? and where in code page?


Do you want the first item from the combobox?

Object firstItem = comboBox.Items[0];


You could try something like this,

object selectedItem = comboBox1.SelectedItem;   
System.Windows.Forms.MessageBox.Show(selectedItem.ToString());

This will work.You should first create the selected item object then use it.
See here : [ComboBox.SelectedItem Property].

Feel free to tell me if I am wrong.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜