Results 1 to 3 of 3

Thread: Datagrid Data validation

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2003
    Posts
    4

    Datagrid Data validation

    I am working on a small demo application for Data Editing and Cheking. I tried it doing with DataGrid, Tlist, dxDBGrid (Quantum Express). Our Main requiremnet is inplace editing with Data validation. Validation Mainly include specific strings such as 1,2,3A,4D,AAA,100 or range of values like 1 to 100, 3A to 9A etc.. Also if a user enters a wrong value, the cell should be reflect the original value and the focus on the same cell.

    What I want to make sure is unless a person enters a valid Data, he should not be allowed to do anything but to edit that particular eroneous cell.. No change of columns or no vertical scrolling not even focus on another control. Something like a lost focus of a text box.


    Kindly Help


    Parag Sinkar
    India

  2. #2
    Addicted Member
    Join Date
    Sep 2003
    Posts
    160
    What I want to make sure is unless a person enters a valid Data, he should not be allowed to do anything but to edit that particular eroneous cell.. No change of columns or no vertical scrolling not even focus on another control. Something like a lost focus of a text box.

    there's two usefull event for you. one is BeforeColUpdate you can put something like this inside

    If datagrid1.Text <> "Valid" Then
    MsgBox Error
    LastRowNo = adoSupplier.Recordset.AbsolutePosition
    LastColNo = ColIndex
    datagrid1.SetFocus
    datagrid1.Col = ColIndex
    datagrid1.SelLength = Len(adoSupplier.Recordset!SupplierName)
    End If

    and another event is VALIDATE which you can put something like that inside which will focus back on that speciall cell in case that its not valid

    If datagrid1.Text <> "Valid" Then
    MsgBox "ERROR"
    datagrid1.SetFocus
    datagrid1.Col = LastColNo
    adoSupplier.Recordset.AbsolutePosition = LastRowNo
    End If

    actually I didn't test it exactly but if you need accurate code let me know.

  3. #3
    Addicted Member
    Join Date
    Nov 2002
    Location
    Viet Nam
    Posts
    142
    I am concerning about this stuff too , i know this thread is a kind of old age , but its contents still help many .
    If you have source code for this , please post here .

    Thanks a lot

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