2
檢索值
我創建了一個toolStripComboBox
並從數據庫中像這樣檢索所有項目列表的選擇:從ToolStripComboBox控件
private void toolStripComboBox1_Click(object sender, EventArgs e)
{
toolStripComboBox1.ComboBox.ValueMember = "month";
toolStripComboBox1.ComboBox.DataSource = dbConnect.selectMonth(); //get all month from the database
}
組合框則顯示所有的一個月數據庫。
後來然後我試圖獲取使用selectedItem
財產以後這樣從ComboBox選擇:
string monthSelect = toolStripComboBox1.SelectedItem.ToString();
但是我得到的值monthSelect = "System.Data.DataRowView"
任何想法如何獲得價值,而不是System.Data.DataRowView
?