关于MSHFlexGrid的编辑功能!
Private Sub Grid1_KeyPress(KeyAscii As Integer)With Grid1
If KeyAscii <> vbKeyReturn Then
c = .Col: R = .Row
txtgrid.Left = .Left + .ColPos(c)
txtgrid.Top = .Top + .RowPos(R)
txtgrid.Width = .ColWidth(c)
txtgrid.Height = .RowHeight(R)
If .TextMatrix(R, c) <> "" Then
txtgrid.Text = .TextMatrix(R, c)
txtgrid.SelStart = 0
txtgrid.SelLength = Len(txtgrid.Text)
Else
txtgrid.Text = ""
End If
txtgrid.Visible = True
txtgrid.SetFocus
End If
End With
End Sub
我的这段代码是键盘击下时激活txtgrid文本框控件,击下的这个键值没有到文本框中;但我的要求是击第一个键时,键值要输到txtgrid文本框,如我击1,文本框出现1