开发者

Insert data as first item

开发者 https://www.devze.com 2023-02-14 04:49 出处:网络
I have a combobox which binds data from the database.It gets the data correctly but I want the first itemI tried but I could not so how can I d开发者_如何学编程o that? and where in code page?Do you wa

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

精彩评论

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