如何用for each in next语句使窗体加载的时候让窗体上所有控件都隐藏?谢谢

解决方案 »

  1.   

    Private Sub Form_Load()
    On Error Resume Next   '有一些控件并没有visible这个属性(如Timer),所以要将这个错误屏蔽掉
    Dim oj As Control
    For Each oj In Form1
       oj.Visible = False
    Next
    End Sub
      

  2.   

    laviewpbt(人一定要靠自己)  的是正解
      

  3.   

    Dim PControl As Control
            For Each PControl In frmRealTimeDetect
                If TypeName(PControl) = "CommandButton" Then
                    If PControl.Caption = "设置" Then
                        PControl.Enabled = False
                    End If
                End If
            Next为什么上面的代码老出现错误:错误代码92 ,错误信息:for循环未初始化??????
      

  4.   

    laviewpbt(人一定要靠自己)非常正确
    to cjcj(c) :
        测试过了,你的程序是对的,没有出现你所说的错误