datagrid errors

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey all,

I was wondering if there was a different way of coding the following snippet.
I have a bound datagrid and I'm using the ErrorProvider to catch errors.
So if I have many fields to validate I just pack them in that procedure? One
if on top of another? Is there something cleaner?

Private Sub m_dt_ColumnChanging(ByVal sender As Object, ByVal e As
System.Data.DataColumnChangeEventArgs) Handles m_dt.ColumnChanging
If e.Column.ColumnName = "LNRSTN" Then
If e.ProposedValue = String.Empty Then
e.Row.SetColumnError(e.Column.ColumnName, "You can't do that")
Else
'e.Row.SetColumnError("LNRSTN", "")
e.Row.ClearErrors()
End If
End If
End Sub
 
Rodchar,

When you have questions about the language VBNet, as this is, than I advice
you the newsgroup for that. However mostly there are in VBNet a lot of
methods and mostly it is a matter of taste. By instance you can make your
own textboxcolumn for this by inheriting the master. As well you can do a
lot with the datasource. As I see it now right, you try to prevent users to
make a column spaces. When it is about DBNull values there is by instance
this.

http://msdn.microsoft.com/library/d...systemdatadatacolumnclassallowdbnulltopic.asp

The VBlanguage newsgroup is.

Microsoft.public.dotnet.languages.vb

I hope this helps?

Cor
 
Back
Top