如何显示更新前一个MsgBox在DataGridView中的复选框?
比方说,我有在DataGridView的复选框行和值是True(选中),我会点击它。 我该怎么让这样的第一?
“你确定要取消吗?是或否”
是=取消选中
否=还是一样(选中)
这是我与我想要的输出代码,但它不工作
Private Sub DataGridView3SelectAll_CurrentCellDirtyStateChanged(
ByVal sender As Object,
ByVal e As EventArgs) Handles DataGridView3.CurrentCellDirtyStateChanged
RemoveHandler DataGridView3.CurrentCellDirtyStateChanged,
AddressOf DataGridView3SelectAll_CurrentCellDirtyStateChanged
If TypeOf DataGridView3.CurrentCell Is DataGridViewCheckBoxCell Then
DataGridView3.EndEdit()
Dim Checked As Boolean = CType(DataGridView3.CurrentCell.Value, Boolean)
Dim xx As String
xx = MsgBox("Are you sure you want to save changes?", vbYesNo)
If xx = vbYesNo Then
If Checked = True Then
Dim s As String = (DataGridView3.Columns(DataGridView3.CurrentCell.ColumnIndex).DataPropertyName)
Dim x As Integer
x = DataGridView3.CurrentCell.RowIndex
Dim con1 As MySqlConnection = New MySqlConnection("datasource=192.168.2.87;database=inventory;userid=root;password=admin1950")
Dim cmdinsert As MySqlCommand = New MySqlCommand("update stock_issuance set `" & s & "` = 1 where `" & s & "` = `" & s & "` and Month = '" & DataGridView3.Rows(x).Cells(1).Value & "'", con1)
con1.Open()
cmdinsert.ExecuteNonQuery()
con1.Close()
ElseIf Checked = False Then
Dim s As String = (DataGridView3.Columns(DataGridView3.CurrentCell.ColumnIndex).DataPropertyName)
Dim x As Integer
x = DataGridView3.CurrentCell.RowIndex
Dim con1 As MySqlConnection = New MySqlConnection("datasource=192.168.2.87;database=inventory;userid=root;password=admin1950")
Dim cmdinsert As MySqlCommand = New MySqlCommand("update stock_issuance set `" & s & "` = 0 where `" & s & "` = `" & s & "` and Month = '" & DataGridView3.Rows(x).Cells(1).Value & "'", con1)
con1.Open()
cmdinsert.ExecuteNonQuery()
con1.Close()
End If
Else
End If
End If
AddHandler DataGridView3.CurrentCellDirtyStateChanged,
AddressOf DataGridView3SelectAll_CurrentCellDirtyStateChanged
End Sub