[c#] How to get the selected item of a combo box to a string variable in c#

Can anyone tell me how to get the selected item of a ComboBox to a string variable?

string selected = cmbbox.SelectedItem.ToString();
MessageBox.Show(selected);

This gives me System.Data.DataRowView in my MessageBox

This question is related to c# combobox

The answer is


SelectedText = this.combobox.SelectionBoxItem.ToString();

Test this

  var selected = this.ComboBox.GetItemText(this.ComboBox.SelectedItem);
  MessageBox.Show(selected);

You can use as below:

string selected = cmbbox.Text;
MessageBox.Show(selected);