Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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?
C#
  • *Experts*
Posted

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

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...