|
-
October 21st, 2008, 01:57 PM
#1
Runtime Error when trying to load a form
When I hit F5 in Visual Basic.NET 2003 to test the program, it loads just fine. From the main form, I have three buttons, each of which takes users to a different form. Two of the buttons work as intended. One of them has been working, but all of a sudden has given me this error message:
"An unhandled exception of type "System.InvalidProgramException' occurred in MyProgram.exe
Additional information: Common Lanaguage Runtime detected an invalid program."
It then highlights in the Windows Form Designer generated code:
InitializeComponent()
Does anyone know how I can fix this? I have no clue what the problem is and I'm a novice with regards to odd runtime errors.
-
October 21st, 2008, 01:59 PM
#2
Re: Runtime Error when trying to load a form
Not nearly enough information....
Simply configure VS to break on exception, and look at the line of code that is faulting. Also be sure to pat attention to the exceptions message and inner exception propertied...
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
October 22nd, 2008, 12:43 AM
#3
Re: Runtime Error when trying to load a form
 Originally Posted by TheCPUWizard
Not nearly enough information....
Well, actually the Exception supplied, is all the info that is needed 
irishman, you may want to look at this MSDN reference :
http://msdn.microsoft.com/en-us/libr...exception.aspx
And here's a Search on MSDN :
http://social.msdn.microsoft.com/Sea...y=Q312544&ac=8
I hope it helps!
Last edited by HanneSThEGreaT; October 22nd, 2008 at 12:47 AM.
-
October 22nd, 2008, 07:32 AM
#4
Re: Runtime Error when trying to load a form
 Originally Posted by HanneSThEGreaT
Well, actually the Exception supplied, is all the info that is needed ;
For VS-2003 (aka .Net 1.x) there are a few interesting situations...lets look at the msdn link you provided:
The exception that is thrown when a program contains invalid Microsoft intermediate language (MSIL) or metadata. Generally this indicates a bug in the compiler that generated the
The most important word here is generally...It does NOT always indicate a bus in the compiler per se....
There are also some user generated code situations that can induce this error. Therefore I stand by my original statement, that until we actually see a program that reproduces the error, there is insufficient information.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
October 22nd, 2008, 07:58 AM
#5
Re: Runtime Error when trying to load a form
Yeah well, I don't know everything as you seem to do, as I don't have 35 years experience as you - But I do know what an error means, and how to fix it, or how to find applicable info on an error. 
I also provided the MSDN search link, if you didn't notice, so let's see what that brings up, and hopefully the OP ( irishman ) will get closer to his solution.
-
October 22nd, 2008, 08:12 AM
#6
Re: Runtime Error when trying to load a form
Irishman
I've had the same error in the past and for me (thankfully) all it took was a rebuild and it was sorted!
Visual Basic 2005 ver. 8.0.50727.867
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|