Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
am getting Exception has been thrown by the target of an invocation error in my below coding...when i start my vs2005 the below coding working...after searching the some folder my below coding was not working....
 

internal static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Main());
        }
    }
}
Posted 22-Feb-13 4:35am
Deenuji3.8K
Comments
CHill60 at 22-Feb-13 9:45am
   
If you wrap this code with a Try-Catch block you can dump the Exception.StackTrace to find out precisely where the exception is being thrown. Alternatively you could use the debugger and the F11 key to find the line of code that's the problem. When you've found the point of failure post the code here using the Improve question link

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The first place I would look is in teh constructor of your Main class, which better be a decendent of the Form class.
 
Start your application in the debugger not by hitting the Start button in Visual Studio, but by hitting F11 to step into the first line of your code, keep hitting F11, one line at a time, and watch the execution of your startup code and variables. You'll eventually hit the line that's failing.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 555
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 22 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100