我有带有两个 datagridviewcombo 列的数据网格,一列是动态填充,一列具有固定的硬编码值。问题是我无法设置动态 GridViewComboBox 的值,当我尝试设置它时会生成持续错误。
System.FormateException:DataGridViewComboBoxCell 值无效。
我加载网格的代码是
Dim dt As DataTable dt = GetDataTable("Select valuecol,displayCol From mytable") 'GetDataTable gives me datatable cmbAntibiotics.DataSource = dt cmbAntibiotics.DisplayMember = "Antibiotics" cmbAntibiotics.ValueMember = "AntibioticsID"
Dim Index As Integer
Dim dgr As DataGridViewRow
For Each dr As DataRow In dtFromDB.Rows 'This datatable is filled with database
Index = dtFromDB.Rows.Count - 1
GRDAntimicrobials.Rows.Add()
GRDAntimicrobials.Rows(Index).Cells("cmbAntibiotics").Value = dr("AntibioticsID").ToString 'At this point it shows value (1,2,3) rather then showing its display members
GRDAntimicrobials.Rows(Index).Cells("AntibioticsStatus").Value = dr("AntibioticsStatus").ToString
Next
请帮帮我