- Back to Home »
- Windows Applications »
- ListBox
Posted by :
Sudhir Chekuri
Monday, 15 February 2016
It is used to show a list of items which you can select.
Default event : SelectedIndexChanged which is fired when user selects and item in listbox.
To add items in the design mode click on the smart tag(Play symbol at the top of the control). Click on edit items. Enter text of items one per line to create multiple items.
Example to display listbox selected item text
Default event : SelectedIndexChanged which is fired when user selects and item in listbox.
To add items in the design mode click on the smart tag(Play symbol at the top of the control). Click on edit items. Enter text of items one per line to create multiple items.
Example to display listbox selected item text
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
label1.Text = listBox1.SelectedItem.ToString();
}