aewarnick Posted February 12, 2003 Posted February 12, 2003 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? Quote C#
*Experts* Nerseus Posted February 12, 2003 *Experts* Posted February 12, 2003 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 Quote "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
aewarnick Posted February 12, 2003 Author Posted February 12, 2003 That was a very good explanation. Quote C#
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.