Search Tools Links Login

EditFlexGrid


This code allows users to edit in a MSFlexGrid

Original Author: Jared Odulio

Assumptions

Just copy and paste this code in the KeyPress event of your MSFlexGrid

Side Effects

No side effects

Code

Private Sub MyFlexGrid_KeyPress(KeyAscii As Integer)
'Provides manual data entry capability to flexgrid
  With MyFlexGrid
    Select Case KeyAscii
      Case vbKeyReturn
        If .Col + 1 <= .Cols - 1 Then
          .Col = .Cols - 1
          ElseIf .Row + 1 <= .Rows - 1 Then
            .Row = .Row + 1
            .Col = 0
          Else
            .Row = 1
            .Col = 0
        End If
      Case vbKeyBack
        If Trim(.Text) <> "" Then
          .Text = Mid(.Text, 1, Len(.Text) - 1)
        End If
      Case Is < 32
        
      Case Else
        If .Col = 0 Or .Row = 0 Then
          Exit Sub
          Else
            .Text = .Text & Chr(KeyAscii)
        End If
          
    
    
    End Select
  
  
  End With
  
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 71 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.