vb 为什么说text1.setfocus是无效的过程调用或参数?

2024-12-21 02:35:18
推荐回答(1个)
回答1:

这是因为窗体尚在加载过程之中,换句话说,窗体本身都没有加载,你就要设置控件的焦点是不行的。可换为:
Private Sub Form_Activate()
Dim i, sum
Text1.Text = ""
Text1.SetFocus
For i = 1 To 9
sum = sum + i
Next i
Text1.Text = sum

End Sub