ComboBox is binding database
string str= comboBox1.SelectedItem.ToString();
the line gives System.Data.DataRowView value for str but not giving selected item name.
try this
if (comboBox1.SelectedItem is DataRowView) {
string sval = ((DataRowView)comboBox1.SelectedItem).Row["ColumnName"].ToString();
}
If you want the text of the selected item, just use comboBox1.Text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With