添加MSHFlexgrid控件的办法如下:
要程序的代码是:Dim i, j, k As Integer
1、设置行列数
With MSHFlexGrid1
.Rows = 5
.Cols = 5
End With
2、添加表头
MSHFlexGrid1.Row = 0
For i = 1 To MSHFlexGrid1.Cols - 1
MSHFlexGrid1.Col = i
MSHFlexGrid1.Text = "列" & i
Next
3、添加记录
k = 1
For i = 1 To MSHFlexGrid1.Rows - 1
For j = 1 To MSHFlexGrid1.Cols - 1
MSHFlexGrid1.Row = i
MSHFlexGrid1.Col = j
MSHFlexGrid1.Text = k
k = k + 1
Next
Next
说明:添加部件"Microsoft Hierarchical FlexGrid Control 6.0 (OLEDB)"才能使用MSHFlexGrid.
菜单 工程-部件 里面找 MICOSOFT MSFLEXGRID CONTROL 6.0