myControl.Hide vs myControl.visible=false

  • Thread starter Thread starter johnb41
  • Start date Start date
J

johnb41

Is there any difference between:

myControl.Hide vs myControl.visible=false

and also:

myControl.Show vs myControl.visible=true

They seem to do the same thing. Any tips on when to use one over the
other?

Thanks for all your help!

John
 
johnb41 said:
Is there any difference between:

myControl.Hide vs myControl.visible=false

and also:

myControl.Show vs myControl.visible=true

They seem to do the same thing. Any tips on when to use one over the
other?

The 'Hide' method simply sets the control's 'Visible' property to 'False',
so it doesn't have any disadvantages to use one instead of the other.
 
johnb41 said:
Is there any difference between:

myControl.Hide vs myControl.visible=false

and also:

myControl.Show vs myControl.visible=true

They seem to do the same thing. Any tips on when to use one over the
other?

The 'Hide' method simply sets the control's 'Visible' property to 'False',
so it doesn't have any disadvantages to use one instead of the other.
 
Thanks Herfried. I had a hunch that was the case, but found no
evidense when googleing it.

John
 
johnb41 said:
Thanks Herfried. I had a hunch that was the case, but found no
evidense when googleing it.

I checked the implementation with Lutz Roeder's Reflector.
 
John,
The documentation for Control.Hide states "Hiding the control is equivalent
to setting the Visible property to false", while Control.Show states
"Showing the control is equivalent to setting the Visible property to true".

http://msdn.microsoft.com/library/d...rfsystemwindowsformscontrolclasshidetopic.asp

http://msdn.microsoft.com/library/d...rfsystemwindowsformscontrolclassshowtopic.asp

I don't see where any more "evidence" is needed! ;-) Although as Herfried
suggests, you could use ILDASM or Reflector to see specifically what the
above remarks mean...

Hope this helps
Jay

| Thanks Herfried. I had a hunch that was the case, but found no
| evidense when googleing it.
|
| John
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top