471,055 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,055 software developers and data experts.

windows form cancel load

Hi,

I'm in C#.
I am trying to close a form in the form_load event.
this.close(); does not work.
Is there another way to do it (maybe cancel this event)
Can someone help me.

Thanks
Jul 21 '05 #1
1 1676
In article <31****************************@phx.gbl>,
m.*********@icsrv.com says...
Hi,

I'm in C#.
I am trying to close a form in the form_load event.
this.close(); does not work.
Is there another way to do it (maybe cancel this event)
Can someone help me.


Take the logic that determines that the form should not load out of form
load and execute it before you even create your form. Something like:

public static void Main()
{
if( code_is_okay_to_run )
{
Application.Run(new Form1());
}
else
{
Console.WriteLine("no way I'm opening that form!");
}
}

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Matthew Wells | last post: by
reply views Thread by Tim Haughton | last post: by
2 posts views Thread by Max | last post: by
1 post views Thread by marc parthoens | last post: by
4 posts views Thread by Graham Charles | last post: by
9 posts views Thread by oz | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.