VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Make MSHFlexGrid Editable without help of any textbox or other control

by Kazi Khalid (1 Submission)
Category: Databases/Data Access/DAO/ADO
Compatability: Visual Basic 5.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (23 Votes)

Make MSHFlexGrid Editable without help of any textbox or other control

Assumes
'Take an MSHFlexgrid name it as msh1

Rate Make MSHFlexGrid Editable without help of any textbox or other control

'in the keypress event of msh1 write the following code.
Private Sub msh1_KeyPress(KeyAscii As Integer)
  Select Case KeyAscii
  
    Case vbKeyReturn, vbKeyTab
      'move to next cell.
      With msh1
        If .Col + 1 <= .Cols - 1 Then
          .Col = .Col + 1
        Else
          If .Row + 1 <= .Rows - 1 Then
            .Row = .Row + 1
            .Col = 0
          Else
            .Row = 1
            .Col = 0
          End If
        End If
      End With
      
    Case vbKeyBack
      With msh1
        'remove the last character, if any.
        If Len(.Text) Then
          .Text = Left(.Text, Len(.Text) - 1)
        End If
      End With
      
    Case Is < 32
    
    Case Else
      With msh1
        .Text = .Text & Chr(KeyAscii)
      End With
      
  End Select
End Sub

Download this snippet    Add to My Saved Code

Make MSHFlexGrid Editable without help of any textbox or other control Comments

No comments have been posted about Make MSHFlexGrid Editable without help of any textbox or other control. Why not be the first to post a comment about Make MSHFlexGrid Editable without help of any textbox or other control.

Post your comment

Subject:
Message:
0/1000 characters