VBA for each control in controls 疑问
我调试的是VBA,应该VB也一样吧。
界面上有个MultiPage1容器,容器内有textbox控件
点击按钮btnReset时把所有textbox控件值设为""。
Private Sub btnReset_Click()
Dim txt As Control
'Set txt = txtTempC '怎么txt等于txtTempC.Text值???
For Each txt In MultiPage1.SelectedItem.Controls
If TypeOf txt Is TextBox Then
'为什么就跳不到这一步?
txt.Text = ""
End If
Next
End Sub
哪位老师帮帮我,谢谢。
[解决办法]
将
If TypeOf txt Is TextBox Then
改成
If TypeOf txt Is MSForms.TextBox Then
即可