hiding all controls on a form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ravindarjobs
    New Member
    • May 2007
    • 86

    #1

    hiding all controls on a form

    i want to hide all controls on a form.

    is there any code like this to hide all the controls with out writing code from each control


    For each control in ....
    ...
    ...
    next


    if so please tell me.

    Thanq
  • BlackMustard
    New Member
    • Aug 2007
    • 88

    #2
    Try

    Code:
       Dim Control As Object
        
        For Each Control In frmMyForm.Controls
            Control.Visible = False
        Next Control

    Comment

    • QVeen72
      Recognized Expert Top Contributor
      • Oct 2006
      • 1445

      #3
      Hi,

      Place all the Controls in a Container like "Frame/PictureBox/SSTab Control".. and Hide the Container...

      REgards
      Veena

      Comment

      • ravindarjobs
        New Member
        • May 2007
        • 86

        #4
        Originally posted by BlackMustard
        [CODE=vb]For Each Control In frmMyForm.Contr ols
        Control.Visible = False
        Next Control[/CODE]
        Thank you.
        It worked well.
        Last edited by Killer42; Sep 4 '07, 03:42 AM. Reason: Fixed quoting.

        Comment

        • hariharanmca
          Top Contributor
          • Dec 2006
          • 1977

          #5
          Originally posted by ravindarjobs
          For each control in ....
          ...
          ...
          next
          I think you are looking for
          [CODE=vb]Form1.Enabled = True or False[/CODE]
          Or
          [CODE=vb]Form1.Visible = True or False[/CODE]

          (It seems you are trying all operation in same form like Hide all controls and show new controls, that is not good practice).

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            Originally posted by hariharanmca
            i think you are looking for
            [CODE=vb] Form1.Enabled = True or False[/CODE]
            Or
            [CODE=vb] Form1.Visible = True or False[/CODE]
            Don't you think that will hide the form itself.

            Then what is the use ?

            Comment

            Working...