VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Simple Code to Navigate through Grid according to User press key

by Raghuraja.C (12 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 6th April 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Simple Code to Navigate through Grid according to User press key

Rate Simple Code to Navigate through Grid according to User press key



    MoveToList MSFlexGrid1, KeyAscii, 1
End Sub

Public Sub MoveToList(Obj As MSFlexGrid, KeyAscii As Integer, Optional intCol As Integer)
    
    'This is pocedurce for to navigate in the list whent the user press any key
    
    Dim intRow      As Integer
    Dim intStartRow As Integer
    Dim blnFlag     As Boolean

    If Obj.Rows = 1 Then Exit Sub
    
    If Obj.Row <> Obj.Rows - 1 Then
        intStartRow = Obj.Row + 1
    Else
        intStartRow = 1
    End If
    
    For intRow = intStartRow To Obj.Rows - 1
       If UCase(Chr(KeyAscii)) = UCase(Left(Trim(Obj.TextMatrix(intRow, intCol)), 1)) Then
          Obj.TopRow = intRow
          Obj.Row = intRow
          Obj.ColSel = Obj.Cols - 1
          GoTo EndHere
       Else
          blnFlag = True
       End If
    Next intRow

    If blnFlag = False Then GoTo EndHere

    For intRow = 1 To intStartRow - 1
       If UCase(Chr(KeyAscii)) = UCase(Left(Trim(Obj.TextMatrix(intRow, intCol)), 1)) Then
          Obj.TopRow = intRow
          Obj.Row = intRow
          Obj.ColSel = Obj.Cols - 1
          Exit For
       End If
    Next intRow

EndHere:

End Sub



Download this snippet    Add to My Saved Code

Simple Code to Navigate through Grid according to User press key Comments

No comments have been posted about Simple Code to Navigate through Grid according to User press key. Why not be the first to post a comment about Simple Code to Navigate through Grid according to User press key.

Post your comment

Subject:
Message:
0/1000 characters