ComboBox in winforms C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

ComboBox in winforms C#

Hello, I need to fill combo box with four option // Fill the season_cb combo box with option season_cb.Items.Insert(0, "Season 1"); season_cb.Items.Insert(1, "Season 2"); season_cb.Items.Insert(2, "Season 3"); season_cb.Items.Insert(3, "Season 4"); season_cb.SelectedIndex = 0; Now I need the selected text MessageBox.Show(season_cb.SelectedText); This gives me " ". please tell me the proper syntax. Advance thanks!

3rd Dec 2017, 11:43 AM
Salman Mushtaq
Salman Mushtaq - avatar
2 Answers
+ 2
https://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.selecteditem(v=vs.110).aspx season_cb.SelectedItem.ToString (); SelectedText is the text that you mark when you want to copy something
3rd Dec 2017, 12:18 PM
sneeze
sneeze - avatar
0
@sneeze, thanks Its work fine
3rd Dec 2017, 12:48 PM
Salman Mushtaq
Salman Mushtaq - avatar