I have a DataGridView with and editable textcolumn and editable checkbox. I attempting to write to the database as soon as the user edits, but the method seems to fire randomly between the two:
Sometimes when I'm editing the column 7 textbox the e.ColumnIndex = 8 checkbox IF statement will fire (but the checkbox itself in column 8 is not updated). I've tried editing the text field and hitting enter, or just clicking off the text cell to let it update. It's intermittent, sometime it works as expected, sometimes it fires the e.ColumnIndex = 8 IF statement.Code:Private Sub DGVSMT_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridSMT.CellContentClick 'This method attempts to convert the formatted, user-specified value to the underlying cell data type. DataGridSMT.CommitEdit(DataGridViewDataErrorContexts.Commit) 'If the value is successfully committed, the CellValueChanged event occurs End Sub Private Sub DGVSMT_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridSMT.CellValueChanged If e.ColumnIndex = 8 Then 'do stuff if checkbox clicked End If If e.ColumnIndex = 7 Then 'do stuff if text field updated End If End Sub
Any ideas?




Reply With Quote
