I have a problem. I need to hide my window at window load. But
private void Form1_Load(object sender, EventArgs e)
{
this.Visible = false;
}
is not working. And property Visible
remains true. Am I missing something?
I have a problem. I need to hide my window at window load. But
private void Form1_Load(object sender, EventArgs e)
{
this.Visible = false;
}
is not working. And property Visible
remains true. Am I missing something?
Use
this.Hide()
to hide your window.this.Close(
) to closeI believe this is because the window doesn't really exist until after this event. The best place to do this is outside the form:
If you really need to do it inside the form itself, then I think you need to use the Activated event.
EDIT:
You could also try something like:
It seems you can use the following:
I just tested it in a winforms app and it worked.
(Also just found this: Single Form Hide on Startup