This website uses cookies to improve service and provide non-personalized ads. By using this site, you agree to this use. See our Privacy Policy and Cookies Info .
Yes, I agree. No, I do not agree.

c# Get selected item text from combobox

2017/10/18 06:03
C# Combobox defined with name my_combobox
private System.Windows.Forms.ComboBox my_combobox;

Read the text of the selected combobox item and assign it to string variable, then show it in message box.
string selected_item_text = my_combobox.GetItemText(my_combobox.SelectedItem); MessageBox.Show(selected_item_text);