Results 1 to 2 of 2

Thread: Datagrid validating user input

  1. #1

    Thread Starter
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530

    Datagrid validating user input

    well if the user enters invalid data in a cell in the datagrid, I am trying to stop them from being able to do anything else except for fix up the invalid entry.

    at the moment when the user enters invalid data, an error icon is displayed in the row header and an error message is shown, but it doesn't stop the user from going to another cell, or even creating additional records.

    So is there a way to restrict the user to the current cell they are working in?

    So far this is the event handler I have to work with:
    Code:
    Private Sub Customers_ColumnChanging(ByVal sender As Object, _
            ByVal e As System.Data.DataColumnChangeEventArgs)
            ' Only check for errors in the Product column
            If (e.Column.ColumnName.Equals("client_name")) Then
                ' Do not allow "Automobile" as a product.
                If CType(LCase(e.ProposedValue), String) = "spank" Then
                    Dim badValue As Object = e.ProposedValue
                    e.ProposedValue = "Bad Data"
                    e.Row.SetColumnError(e.Column, "Product cannot be " & _
                    "spank")
    
                Else
                    e.Row.ClearErrors()
    
                End If
            Else
            End If
        End Sub

  2. #2

    Thread Starter
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    bump.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width