我想自己逐条的往这个控件里添加字段,可是我老是碰到下标越界的问题。有谁可以告诉我下 下标的定义和使用方法吗? 最好有个实例代码给我看下谢谢了
下标 就是数组超出范围了....
Private Sub Form_Load()
Dim Titlestr1(), Titlestr2()
Titlestr1() = Array(" ", "0 ", "1 ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ", "9 ",_
" A", " B", " C", " D", " E", " F")
Titlestr2() = Array(" ", "00 ", "01 ", "02 ", "03 ", "04 ", "05 ", "06 ", "07 ", "08 ",_
"09 ", "0A ", "0B ", "0C ", "0D ", "0E ", "0F ", "10 ", "11 ", "12 ", "13 ", "14 ", "15 ", "16 ")
MSFG1.Rows=24
MSFG1.Cols=17
MSFG1.Row = 0
For i = 0 To MSFG1.Rows - 1
MSFG1.Col = i
MSFG1.ColWidth(i) = 380
MSFG1.Text = Titlestr1(i)
Next i
MSFG1.Col = 0
For i = 0 To MSFG1.Rows - 1
MSFG1.Row = i
MSFG1.RowHeight(i) = 260
MSFG1.Text = Titlestr2(i)
Next i
End Sub
增加字段时若检测到下标溢出,需要增加行OR列时,可以用 MSFG1.Rows=MSFG1.Rows + 1, MSFG1.Cols=MSFG1.Cols + 1
来解决,