Visible Property

See AlsoM8YSO2              Example8P0ZZSD>Low

Applies To

Form14TJ2LN, MDI form1ILMZQ7, check box9P3BU5, combo box1YZXFF6, command buttonXJSPC0, common dialog,1H1HYJI data control2E1FEX3, directory list boxO9U5A0, drive list box5WJO0PW, file list box1M6S8UX, frame1KX6ZP8, grid2VGT0PT, horizontal scroll bar1JSJOS7, image9A4FCA, label3MNIZ8D, lineTW530P, list boxG11UCK, menuBKDT1F, OLE control2HQDVVU, option buttonJYBO08, picture box31MYIWX, shape9JZFLA, text boxYPYZDG, vertical scroll bar1JSJOS7.


Determines whether an object is visible or hidden.


[form.][control.]Visible[ = boolean ]


The Visible property settings are:

Setting          Description


True              (Default) Object is visible.

False             Object is hidden.



To hide a control at startup, set the Visible property to False at design time.  Setting this property in code allows you to hide and later redisplay a control at run time in response to a particular event.


Note   Using the Show2IF9Z3Q or HideGU6180 method on a form is the same as setting the form's Visible property in code to True or False, respectively.

An MDI childBJG7BM form cannot be hidden.


Data Type

IntegerDOKXHY (Boolean)

See Also


Hide MethodGU6180

Load StatementGU0759

Show Method2IF9Z3Q


Programmer's Guide:

Chapter 15, "Creating Graphics for Applications"

Visible Property Example

The example creates animation using two picture boxes.  To try this example, paste the code into the Declarations section of a form that contains two icon-sized picture boxes.  Set Name to FileCab for both picture boxes to create an array.  Then press F5 and click the picture control to view the animation.

Sub Form_Load ()

   Dim I                                 ' Declare variable.

   FileCab(0).BorderStyle = 0            ' Set BorderStyle.

   FileCab(1).BorderStyle = 0

   ' Load icons into picture boxes.

   FileCab(1).Picture = LoadPicture("icons\office\files03b.ico")

   FileCab(0).Picture = LoadPicture("icons\office\files03a.ico")

   For I = 0 To 1

      FileCab(I).Move 400, 400           ' Place pictures at same spot.

   Next I

   FileCab(1).Visible = False            ' Set to invisible.

   FileCab(0).Visible = True             ' Set to visible.

End Sub


Sub FileCab_Click (Index As Integer)

   Dim I                                 ' Declare variable.

   For I = 0 To 1

      ' Switch the visibility for both pictures.

      FileCab(I).Visible = Not FileCab(I).Visible

   Next I

End Sub