wessamzeidan Posted March 9, 2004 Posted March 9, 2004 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???? Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
Heiko Posted March 9, 2004 Posted March 9, 2004 Any imported (referenced) objects on the splash screen ? Quote .nerd
wessamzeidan Posted March 9, 2004 Author Posted March 9, 2004 No, the only thing I have on the form is a background image... Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
TechnoTone Posted March 9, 2004 Posted March 9, 2004 What happens if you change the "Me.Dispose()" to "Me.Close()"? Quote TT (*_*) There are 10 types of people in this world; those that understand binary and those that don't.
wessamzeidan Posted March 9, 2004 Author Posted March 9, 2004 The same thing........ Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
*Experts* Nerseus Posted March 9, 2004 *Experts* Posted March 9, 2004 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 Quote "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
wessamzeidan Posted March 9, 2004 Author Posted March 9, 2004 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..... Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
Heiko Posted March 9, 2004 Posted March 9, 2004 There was a sample around, where a splash screen was shown until the Application.Idle event was raised. Quote .nerd
Joe Mamma Posted March 9, 2004 Posted March 9, 2004 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 Quote 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.
Administrators PlausiblyDamp Posted March 9, 2004 Administrators Posted March 9, 2004 http://www.xtremedotnettalk.com/showthread.php?t=77706 Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
wessamzeidan Posted March 9, 2004 Author Posted March 9, 2004 Thanks alot Joe, I used your way and it was exactly what I wanted... Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
Joe Mamma Posted March 9, 2004 Posted March 9, 2004 Thanks alot Joe' date=' I used your way and it was exactly what I wanted...[/quote'] You're welcome jo Quote 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.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.