473,503 Members | 6,587 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exception on Form Load

Hi,

I have a form, on whose FormLoad event I have an
exception being thrown.

I catch that exception and give a this.Close().

But this doesn't work; the error is 'Cannot call Close()
when a handle is being created'.

So how could i close the form during form load?

Thanks
Rakehs

Nov 15 '05 #1
3 2359
try,

this.Dispose();
or
Application.Exit();

pei

"Rakesh" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
Hi,

I have a form, on whose FormLoad event I have an
exception being thrown.

I catch that exception and give a this.Close().

But this doesn't work; the error is 'Cannot call Close()
when a handle is being created'.

So how could i close the form during form load?

Thanks
Rakehs

Nov 15 '05 #2
this.Dispose gives me the same error.

I don't want to close my application either.

-----Original Message-----
try,

this.Dispose();
or
Application.Exit();

pei

"Rakesh" <an*******@discussions.microsoft.com> wrote in messagenews:01****************************@phx.gbl...
Hi,

I have a form, on whose FormLoad event I have an
exception being thrown.

I catch that exception and give a this.Close().

But this doesn't work; the error is 'Cannot call Close () when a handle is being created'.

So how could i close the form during form load?

Thanks
Rakehs

.

Nov 15 '05 #3
Are you handling the FormLoad event?? If so, may be something you're doing
is causing the exception.

Can you post a snippet of code?

-vJ

"Rakesh" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
Hi,

I have a form, on whose FormLoad event I have an
exception being thrown.

I catch that exception and give a this.Close().

But this doesn't work; the error is 'Cannot call Close()
when a handle is being created'.

So how could i close the form during form load?

Thanks
Rakehs

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
4803
by: gregory_may | last post by:
I have an application I created called "JpegViewer.exe". It simply loads a Jpeg file and displays in on the screen. It works great, in my lab. When I am using it at a customer site, things...
4
15797
by: maricel | last post by:
I have the following base table structure - DDL: CREATE TABLE "ADMINISTRATOR"."T1" ( "C1" INTEGER NOT NULL ) IN "TEST_TS" ; ALTER TABLE "ADMINISTRATOR"."T1" ADD PRIMARY KEY
0
7462
by: Darkoł | last post by:
I'm trying to do a simple web form with asp.net & C# but althoug the page is correctly compilated, when i load the page there is the following error message: System.Web.HttpException: External...
4
1596
by: Dan | last post by:
I am back yet again :) I am encountering an Exception that has me scratching my head. I have two forms. Form A launches Form B in response to the user clicking a button. The Constructor for Form...
44
4159
by: craig | last post by:
I am wondering if there are some best practices for determining a strategy for using try/catch blocks within an application. My current thoughts are: 1. The code the initiates any high-level...
6
4045
by: Steve Long | last post by:
Help, I'm running VS.NET 2003 and when I try to start my application, I get the "unhandled exception" dialog instead of the IDE highlighting the offending line of code. The problem appears to be...
5
5723
by: Lucvdv | last post by:
Can someone explain why this code pops up a messagebox saying the ThreadAbortException wasn't handled? The first exception is reported only in the debug pane, as expected. The second (caused by...
7
1696
by: ZorpiedoMan | last post by:
Well, I'm still wondering around in the "land of the lost exception"... It seems that controls that are bound to a class and the class throws an error in the SET method of the bound member, the...
2
1621
by: Raju Joseph | last post by:
Hi All, I am trying to implement some common services for DataGrid control by implementing IExtendee and providing users with some properties they can set. I need to process some code in the...
11
5544
by: chopsnsauce | last post by:
Here's the example: Dim frm As New FORM1 Try frm.show Catch ex As Exception msgbox ex.message
0
7264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5562
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.