<in da clubwrote in message news:O3**************@TK2MSFTNGP04.phx.gbl...
>I dont want to have minimized Form ..
I want to have a form which not visible any part of the screen.
It is easy in Vb. I want to have a command like Form1.visible=false in VB
?
Marc already explained the problem with the code you posted to you.
The code you posted doesn't modify the form instance...it incorrectly
attempts to modify the class itself. You need to modify the form instance
if you want to change the Visible property of your form.
To do this, obviously you need two things:
* The reference to the instance
* Time to execute the code
As has been pointed out, the Run method won't return until the form has been
closed, so setting Visible in code after calling the Run method won't work
(even if you were setting the property on the instance, rather than using
the incorrect syntax you've got now). To manage the second item above, you
need to put the code to set the Visible property somewhere that will be run
before the form would actually be used. For example, the handler for the
Load event of the form.
If you put the code to set the Visible property in the handler for the Load
event, then getting the reference is easy. The handler would be a method
inside the form's class itself, and thus the Visible property is immediately
available to you, resolving the first item above:
void Form1_Load(object obj, EventArgs e)
{
Visible = false;
}
Pete