Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi, I have an application with 3 forms. One is used as a splash screen, another as the main form and the third as a dialog form. I'm using the main procedure to launch my program. The program was working fine when I had no splash form, but when I added the splash form, I got a strange error.

 

The error occurs when I close the dialog form, I have a button on the form that closes it, it has this line of code

 

me.dispose()

 

When I click this button I get this error

 

'An unhandled exception of type 'System.Runtime.InteropServices.SEHException' occurred in system.windows.forms.dll

 

Additional information: External component has thrown an exception.'

 

and the program stops at this line

 

Application.Run(new splash)

 

Any one has an idea from where does this error come from????

Proudly a Palestinian

Microsoft ASP.NET MVP

My Blog: wessamzeidan.net

  • *Experts*
Posted

First, you don't want to use Application.Run(splash) - your app will close as soon as the splash form goes away. When you use Application.Run this way it means "run my app until the form specified is closed".

 

Search the forums for "splash" and you'll get a couple of good hints. The basic idea is to use Application.Run(frmMain) and from within frmMain show frmSplash. There are other methods to do what you want, I'd search the forums and read the help on Application.Run.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted
Thanks alot for the help. What I do is I show the splash form for 3 seconds, hide it and then show the main form. I use the closing event of the main form to call Application.Exit() to quit the program, I don't know if this is a good way of doing it.....

Proudly a Palestinian

Microsoft ASP.NET MVP

My Blog: wessamzeidan.net

Posted

you can define a constructor for your main form that takes a form as an argument, in the Idle event of your main form destroy the splash

 

SplashScreen splash = new SplashScreen();
splash.Visible = true;
Application.Run(new MainForm(splash));

 

joe mamma

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Posted
Thanks alot Joe' date=' I used your way and it was exactly what I wanted...[/quote']

You're welcome

 

jo

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...