Validate msflexgrid's cells

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • WhiteShore
    New Member
    • Nov 2007
    • 44

    Validate msflexgrid's cells

    Just another msflexgrid's topic..

    does anyone know how to validate the cell from msflexgrid?

    for example i want to validate the column(3) if it's not numeric (after editing) then it would disable moving to other cells until it completely fulfill the condition.

    Here's my code
    Code:
    Private Sub MSFlexGrid1_LeaveCell()
    For i = 1 To MSFlexGrid1.Rows - 2
    If IsNumeric(MSFlexGrid1.TextMatrix(i, 3)) Then
        MSFlexGrid1.CellBackColor = &H80000005 
    Else
        MsgBox "data invalid"
    End If
    Next
    End Sub
    It works but it wont disable the movement when i typed data that is not numeric =(
  • CyberSoftHari
    Recognized Expert Contributor
    • Sep 2007
    • 488

    #2
    Did you tried it in Grid_KeyUp event ?

    Comment

    • WhiteShore
      New Member
      • Nov 2007
      • 44

      #3
      Originally posted by CyberSoftHari
      Did you tried it in Grid_KeyUp event ?
      yup but it wont work though..

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Hi,

        Writing code in LeaveCell doesnt stop moving to the next cell..
        All you can do is Just before Saving, Do a Through Checking of the Column..

        Or else Place TextBox on the Grid Cell To Enter Data, and write code in TextBox's Validate event..


        REgards
        Veena

        Comment

        Working...