J
JT
Hi,
I have the sub below to handle the DataColumnChange Event
in a datagrid on a Windows Form. I want it to reject any
attempted user changes in the InsID column if the Primary
Key (e.Row(0)) of the datarow is greater than 0 (ie, from
the database and not autogenerated. It seems to work, but
it also shows the message box, which I truncated here,
even if the column selected for change is not the InsID
column. Any thoughts on what I am doing wrong? Also, is
there a better way to specify my column other than
with .ColumnName? Thanks.
JT
Private Shared Sub InsIDColumn_Changed(ByVal sender As
Object, ByVal e As DataColumnChangeEventArgs)
With e
If .Column.ColumnName = "InsID" AndAlso CInt(.Row(0)) >
0 Then
.Row.RejectChanges()
MessageBox.Show
End If
End With
End Sub
I have the sub below to handle the DataColumnChange Event
in a datagrid on a Windows Form. I want it to reject any
attempted user changes in the InsID column if the Primary
Key (e.Row(0)) of the datarow is greater than 0 (ie, from
the database and not autogenerated. It seems to work, but
it also shows the message box, which I truncated here,
even if the column selected for change is not the InsID
column. Any thoughts on what I am doing wrong? Also, is
there a better way to specify my column other than
with .ColumnName? Thanks.
JT
Private Shared Sub InsIDColumn_Changed(ByVal sender As
Object, ByVal e As DataColumnChangeEventArgs)
With e
If .Column.ColumnName = "InsID" AndAlso CInt(.Row(0)) >
0 Then
.Row.RejectChanges()
MessageBox.Show
End If
End With
End Sub