在窗体上添加一个msflexgrid之后 在添加一个text
然后用如下代码,即可实现输入功能
Private Sub Form_Load()
Text5.Move -10000, -10000, 1, 1
End Sub
Private Sub MSFlexGrid1_EnterCell()
'MSFlexGrid1.CellBackColor = vbBlue
'MSFlexGrid1.CellForeColor = vbWhite
Text5.Text = MSFlexGrid1.Text
Text5.SelStart = 0
Text5.SelLength = Len(Text1.Text)
End Sub
Private Sub MSFlexGrid1_LeaveCell()
'MSFlexGrid1.CellBackColor = vbWhite
'MSFlexGrid1.CellForeColor = vbBlue
End Sub
Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Text5.SetFocus
End Sub
Private Sub Text5_Change()
MSFlexGrid1.Text = Text5.Text
End Sub
Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft, vbKeyRight, vbKeyUp, vbKeyDown
KeyCode = 0
End Select
End Sub