Hi
i use this code for hide form but when i run project form is shown !!! where is probleam ???
thanks

private void Form1_Load(object sender, EventArgs e)
        {
            this.Visible = false;                
        }

I think it's because the Form_Load event happens before the form itself is shown, therefore there is nothing to hide. I'm not sure but that's my guess, I don't have a solution for you yet though. I'm sure someone here will come up with something soon.

Hi
i use this code for hide form but when i run project form is shown !!! where is probleam ???
thanks

private void Form1_Load(object sender, EventArgs e)
        {
            this.Visible = false;                
        }

Hello,

Try

this.hide

Or

this.hide()

Cannot remember if it needs the brackets or not.

Edited 6 Years Ago by Ap0ca1ypse: Missed out some info

Apologies,

i forgot to add to the end of the code ;

this.hide();

thanks for pointing that out onlinessp, i'm new myself and still finding it tricky to remember what to type when not in front of the code on my computer.

Try this

protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    this.Opacity = 0;
}

protected override void OnShown(EventArgs e)
{
    base.OnShown(e);
    this.Visible = false;
    this.Opacity = 100;
}

Or this if you're not happy with overrides.

private void Form1_Load(object sender, EventArgs e)
{
    this.Opacity = 0;
}

private void Form1_Shown(object sender, EventArgs e)
{
    this.Visible = false;
    this.Opacity = 100;
}

this is my code i do it for show splash

public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Hide();           
            SplashScreen splash = new SplashScreen();
            splash.Show();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.Show();
        }
    }

but its not work !!!

The form is shown by the shown event.
Hiding the form before this has no effect as the Show method will override it.
My code uses the forms Opacity property to make the form invisible.
Since you do not actually need to 'hide' your form you can set Opacity to 0 in form load then set is to 100 in your timer event.

private void Form1_Load(object sender, EventArgs e)
        {
            //this.Hide();           
            this.Opacity = 0;
            SplashScreen splash = new SplashScreen();
            splash.Show();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            //this.Show();
            this.Opacity = 100;
        }
This article has been dead for over six months. Start a new discussion instead.