Difference between Visible and Show()/Hide()

aewarnick

Senior Contributor
Joined
Jan 29, 2003
Messages
1,031
I have a button that needs displayed once in a while. Is it better to make it Visible=true or use Show and Hide methods? I know that Visible is a property but what other differences are there?
 
I would use the Visible property, if you really need to hide the button. Show and Hide is generally for a form.

Does the button need to toggle while the form is open, or will it always be visible/invisible for each instance of the form? For example, suppose you have a checkbox that toggles whether the button is visible or not. I would NOT change the visible property in this case but instead use the Enabled property. If your are doing something in the Load event that determines whether the user has the button, then use the Visible property since you'll never want them to have access to the button.

What you don't want is to have the button disappearing and reappearing. You don't really want ANY controls to appear/disappear on the fly. This is only acceptable for menus and generally only in MDI where the MDI form's menu may change in relation to the current child.

-Nerseus
 
Back
Top