Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 13 'ENTER key
With MSFlexGrid1
.HighLight = flexHighlightNever 'turn off hi-lite
If .Col < .Cols - 1 Then
.Col = .Col + 1
Else
If .Row < .Rows - 1 Then
.Row = .Row + 1 'down 1 row
.Col = 1 'first column
Else
.Row = 1
.Col = 1
End If
End If
If .CellTop + .CellHeight > .Top + .Height Then
.TopRow = .TopRow + 1 'make sure row is visible
End If
.HighLight = flexHighlightAlways 'turn on hi-lite
End With
Case 8 'Backspace
If Len(MSFlexGrid1) Then
MSFlexGrid1 = Left$(MSFlexGrid1, Len(MSFlexGrid1) - 1)
End If
Case 27 'ESC
If MSFlexGrid1.Tag > "" Then 'only if not NULL
MSFlexGrid1d = MSFlexGrid1.Tag 'restore original text
End If
Case Else
MSFlexGrid1 = MSFlexGrid1 + Chr(KeyAscii)
End Select
End Sub
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。