VB 6.0中使用msflexgrid控件,如何插入一行?

VB 6.0中使用msflexgrid控件,如何插入一行?,第1张

msflexgrid.Rows = msflexgrid.Rows + 1

For i = msflexgrid.Rows - 1 To msflexgrid.Row + 2 Step -1

For j = 0 To msflexgrid.Cols - 1

msflexgrid.TextMatrix(i, j) = msflexgrid.TextMatrix(i - 1, j)

Next

Next

msflexgrid.Row = msflexgrid.Row + 1

For i = msflexgrid.Row To msflexgrid.Row

For j = 0 To msflexgrid.Cols - 1

msflexgrid.TextMatrix(i, j) = ""

Next

Next

'MSHFlexGrid1是不能输入的,只有通过一个text来输入

Private Sub MSHFlexGrid1_Click()

Dim i As Long

With MSHFlexGrid1

If .Col = 1 Then

Text1.Text = Trim(.Text)

Text1.Left = .CellLeft - 10

Text1.Top = .CellTop - 10

Text1.Height = .CellHeight

Text1.Width = .CellWidth

Text1.Visible = True

Text1.SetFocus

Else

Text1.Visible = False

End If

End With

End Sub

Private Sub Text1_Change()

With MSHFlexGrid1

.Text = Trim(Text1.Text)

End With

End Sub

简单

你取数据的时候把一共有多少条数据也一起算出来.

假设定义为AllRows

然后定义行数的时候这样写就OK了

Grid.Rows = Number(AllRows)+1


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11622173.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-17
下一篇 2023-05-17

发表评论

登录后才能评论

评论列表(0条)

保存