Option ExplicitPrivate Sub Form_Load() '添加一个文本框控件 Text1.BorderStyle = 0 End SubPrivate Sub MSFlexGrid1_Click() With Text1 .Left = MSFlexGrid1.Left + MSFlexGrid1.CellLeft .Top = MSFlexGrid1.Top + MSFlexGrid1.CellTop .Width = MSFlexGrid1.CellWidth .Height = MSFlexGrid1.CellHeight .Visible = True .SetFocus End With End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then With MSFlexGrid1 .TextMatrix(.Row, .Col) = Text1.Text End With Text1.Visible = False End If End Sub
如:你要改: 第1行,第2列的值则为:msflexgrid.textmatrix(1,2) = "1234" '1234为你要改的值
MSFlexGrid1.row=2
MSFlexGrid1.col=2
MSFlexGrid1.text=""ABC2、
MSFlexGrid1.TextMatrix(2,2)="ABC"
我是说运行中直接在格子里改数据?
例如:第一行,第一列格子的数据为1234,我要直接将它改为123,像EXCEL的效果.
也有人用浮动控件对其进行屏幕编辑。
[email protected]
去google搜索一下,很多地方都可下载
'添加一个文本框控件
Text1.BorderStyle = 0
End SubPrivate Sub MSFlexGrid1_Click()
With Text1
.Left = MSFlexGrid1.Left + MSFlexGrid1.CellLeft
.Top = MSFlexGrid1.Top + MSFlexGrid1.CellTop
.Width = MSFlexGrid1.CellWidth
.Height = MSFlexGrid1.CellHeight
.Visible = True
.SetFocus
End With
End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
With MSFlexGrid1
.TextMatrix(.Row, .Col) = Text1.Text
End With
Text1.Visible = False
End If
End Sub