A
Agnes
in the datagrid, if the user use backspace to delete it . Then I will got an
dbnull error .
How.
In the datatable columnchanged event.
Private Sub dtGLJnDetail_ColumnChanged(ByVal sender As Object, ByVal e As
System.Data.DataColumnChangeEventArgs) Handles dtGLJnDetail.ColumnChanged
If IsDBNull(Me.dgDetail(dgDetail.CurrentCell.RowNumber,
dgDetail.CurrentCell.ColumnNumber)) = True Then
Me.dgDetail(dgDetail.CurrentCell.RowNumber,
dgDetail.CurrentCell.ColumnNumber) = "" <--- It can solve BUT....
End If
(A) IF e.row("acctcode") = "" then Messagebox.show("Account Code Cannot
Be Blank!") <--- It doesn't work .
(B) Dim strAcctCode as string
strAcctCode = e.Row("acctcode")
If strAcctCode.Trim.Length = 0 Then Messagebox.show("Account Code
Cannot Be Blank!") <-- It works.
Why(A) doesn't work . my datagrid got 10 columns. If I use approach (B) ,
it seems very stupid.
Does anyone got other idea ? Thanks a lot
dbnull error .
How.
In the datatable columnchanged event.
Private Sub dtGLJnDetail_ColumnChanged(ByVal sender As Object, ByVal e As
System.Data.DataColumnChangeEventArgs) Handles dtGLJnDetail.ColumnChanged
If IsDBNull(Me.dgDetail(dgDetail.CurrentCell.RowNumber,
dgDetail.CurrentCell.ColumnNumber)) = True Then
Me.dgDetail(dgDetail.CurrentCell.RowNumber,
dgDetail.CurrentCell.ColumnNumber) = "" <--- It can solve BUT....
End If
(A) IF e.row("acctcode") = "" then Messagebox.show("Account Code Cannot
Be Blank!") <--- It doesn't work .
(B) Dim strAcctCode as string
strAcctCode = e.Row("acctcode")
If strAcctCode.Trim.Length = 0 Then Messagebox.show("Account Code
Cannot Be Blank!") <-- It works.
Why(A) doesn't work . my datagrid got 10 columns. If I use approach (B) ,
it seems very stupid.
Does anyone got other idea ? Thanks a lot