下面的代码效果很好:
dashboard1.Text = charArray(0)
dashboard2.Text = charArray(1)
dashboard3.Text = charArray(2)
dashboard4.Text = charArray(3)
dashboard5.Text = charArray(4)
dashboard6.Text = charArray(5)
dashboard7.Text = ""
dashboard8.Text = ""
dashboard9.Text = ""
dashboard10.Text = ""
If dashboardl >= 7 Then
dashboard7.Text = charArray(6)
End If
If dashboardl >= 8 Then
dashboard8.Text = charArray(7)
End If
If dashboardl >= 9 Then
dashboard9.Text = charArray(8)
End If
If dashboardl >= 10 Then
dashboard10.Text = charArray(9)
End If
但是,我想将它们转换为 FOR 循环,如下例所示,但出现错误。
For i = 1 To (dashboardl)
("dashboard" & CStr(i)) = charArray(i - 1)
Next i
非常感谢您的帮助。