datagrid errors

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rodchar

    datagrid errors

    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_ColumnChan ging(ByVal sender As Object, ByVal e As
    System.Data.Dat aColumnChangeEv entArgs) Handles m_dt.ColumnChan ging
    If e.Column.Column Name = "LNRSTN" Then
    If e.ProposedValue = String.Empty Then
    e.Row.SetColumn Error(e.Column. ColumnName, "You can't do that")
    Else
    'e.Row.SetColum nError("LNRSTN" , "")
    e.Row.ClearErro rs()
    End If
    End If
    End Sub
  • Cor Ligthert

    #2
    Re: datagrid errors

    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.



    The VBlanguage newsgroup is.

    Microsoft.publi c.dotnet.langua ges.vb

    I hope this helps?

    Cor
    [color=blue]
    > I was wondering if there was a different way of coding the following[/color]
    snippet.[color=blue]
    > 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?[/color]
    One[color=blue]
    > if on top of another? Is there something cleaner?
    >
    > Private Sub m_dt_ColumnChan ging(ByVal sender As Object, ByVal e As
    > System.Data.Dat aColumnChangeEv entArgs) Handles m_dt.ColumnChan ging
    > If e.Column.Column Name = "LNRSTN" Then
    > If e.ProposedValue = String.Empty Then
    > e.Row.SetColumn Error(e.Column. ColumnName, "You can't do[/color]
    that")[color=blue]
    > Else
    > 'e.Row.SetColum nError("LNRSTN" , "")
    > e.Row.ClearErro rs()
    > End If
    > End If
    > End Sub[/color]


    Comment

    Working...