Why can't I set my form invisible in the Form Load event ?
Sorry to be abrupt but I'm stumped as to why this property doesnt work ?
Cheers.
Chubby.
Printable View
Why can't I set my form invisible in the Form Load event ?
Sorry to be abrupt but I'm stumped as to why this property doesnt work ?
Cheers.
Chubby.
It does work but the form gets drawn on form_Paint which comes after form_load you can see this for yourself by doing the following and you'll notice that the form isn't displayed for 15 secondsSo if you needed to you could set the form.visible = false; in form_paint.Code:private void Form1_Load(object sender, System.EventArgs e)
{
Thread.Sleep(15000);
}
Quote:
Originally Posted by Fishcake
:mad:
Thanks :thumb:
I went round the houses with this (and probably this is the right way to do it (not saying your way is wrong, just for what I need I really should use a static void Main() in a separate class),
the .Net example: ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vbtskSettingFormToBeInvisibleAtItsInception.htm
explains the lifetime of the form etc but in basic terms, add a new Class to the NameSpace containing the instance of the form, then add a static void Main() (remembering to declare the instance of your form outside of this (again, static) and put similar code to thefollowing in the Main (ensure the startup object of the project points to the new Main())
Thanks for the help, would have been eaiser with the Paint I'm sure !Code:public class MainApp
{
public static frmPop f;
public static void Main()
{
f = new frmPop();
f.Visible = false;
Application.Run(f);
}
}
Cheers.
Chubby.
The way you've posted is how i would open form on application start. Sorry wasn't clear what you wanted from your first post. I was wondering what you were going to do with your invisible form after you'd opened it.
sorry for the confusion, I (as you can more likely gather) am new to c#... (and .Net in general) and still basing my theories out of the old VB... :rolleyes:Quote:
Originally Posted by Fishcake
Just expected to be able to set the Form non-visual with a property, and when unable to do that, the natural progression was to set it on inception using code, and when that didn't work.... :confused: :confused:
Thanks
Chubby..