datagridviewでチェックボックスを更新する前にmsgboxを表示するには?
Datagridview にチェックボックスのある行があり、その値が True(Checked) であり、それをクリックするとします。どうすればこのようなものを最初に表示できますか?
「これをオフにしてもよろしいですか? はいまたはいいえ」
はい = チェックを外す
いいえ = 変わらない (チェックあり)
ここに私が望む出力を含む私のコードがありますが、機能していません
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