Rated
Read 15,331 times
Related Categories
A quick way to toggle visibility
If you want show something when its hidden, or hide it if its showing you may
do this:
If Control1.Visible = True Then
Control1.Visible = False
ElseIf Control1.Visible = False Then
Control1.Visible = True
End If
However, a quicker way is to do:
Control1.Visible = Not Control1.Visible
Also, if you have a menu like 'View Toolbar' you can use the resultant visibility
to set the checkmark on it. For Example
Private Sub mnuViewToolbar_Click()
tbToolbar.Visible = Not tbToolbar.Visible
mnuViewToolbar.Checked = tbToolbar.Visible
End Sub
By the way, if you make the item visible in the first place, make sure the menu
is checked by default.
-Daniel Okely
Inaugural Developerfusion.com Prize Winner
Visual Basic programming since 1997, ASP since early 2001. Now programming VB .NET, C#, Java, J#, C++, and ASP.NET. Also, Access, Web Design, Music Software, and Graphic Design
Daniel Okely
Comments
-
Posted by arthur99 on 11 Oct 2005
My knowledge of VBA is very poor so I was wondering if someone could advise me how to disable menu items such as those that drop down from the FILE or TOOLS menus or even the whole menu.
What I wou... -
Posted by liserdarts on 09 Oct 2001
I think it would be best to just introduce the not operator and then show its uses(like toggling visibility).
|