我有一个已检查的gridview和列表框,我想在列表框中添加一个项目
如果我checked=true
,列表框添加项目1,和
if checked=false
,listbox add item 0
oda = New OleDbDataAdapter("SELECT IdGejala, Pertanyaan FROM tbGejala ", conn)
ds = New DataSet
Dim cbGejala As New DataGridViewCheckBoxColumn
cbGejala.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader
cbGejala.TrueValue = 1 cbGejala.FalseValue = 0 cbGejala.ThreeState = 1 cbGejala.IndeterminateValue = System.DBNull.Value cbGejala.DataPropertyName = "Checkbox"
cbGejala.HeaderText = "Gejala anda"
cbGejala.ReadOnly = False
dgvDiagnosa.Columns.Add(cbGejala)
ds.Clear()
oda.Fill(ds, "tbGejala")
dgvDiagnosa.DataSource = (ds.Tables("tbGejala"))
Dim irow As Integer
Dim nilai As String
For irow = 0 To dgvDiagnosa.Rows.Count - 1
If dgvDiagnosa.Rows(irow).Cells("Gejala anda").Value Then
If cbGejala.TrueValue = 1 Then
nilai = 1 checklistbox.add.item(nilai)
End If Else nilai = 0 checklistbox.add.item(nilai)
End If
Next irow
其他信息:无法找到名为“Gejala anda”的列。