我面临着从数据库中获取组合框的价值的问题
`String stri = "Select [Interest] from tbl_Interests";
SqlCommand command = new SqlCommand(stri, con);
SqlDataAdapter da = new SqlDataAdapter(command);
DataSet ds = new DataSet();
da.Fill(ds,"tbl_Interests");
cmbTypeofList.DataSource = ds.Tables["tbl_Interests"];
cmbTypeofList.ValueMember = "Interest";`
打电话给它
string intr = cmbTypeofList.SelectedItem.ToString();
string intr = cmbTypeofList.SelectedValue.ToString();
在上述两种情况下,我将所选值作为System.Data.DataRowView
string intr = cmbTypeofList.SelectedText;
如果我给出上述方式我得到“”空值
如何在C#windowsapp
中获取组合框的选定值