0
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Application.Run(new FrmMain());

An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll

Additional information: Exception has been thrown by the target of an invocation.

what is the problem??!!

 label12.BeginInvoke(new Action(() =>
{
label12.Text += Convert.ToString(s);
}));

when i continue error became like this An unhandled exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll

Additional information: Invoke or BeginInvoke cannot be called on a control until the window handle has been created.

tr_pouya
  • 27
  • 1
  • 8
  • If you show the *complete* exception, I suspect you'll find that the InnerException gives you all the information you need. (It's not clear whether the InvalidOperationException is the InnerException of TargetInvocationException, or whether it's something else... Your question is pretty unclear.) – Jon Skeet Aug 08 '17 at 09:21
  • Well because from what you've posted, we can't tell you what caused the exception... you might want to check for the `InnerException` of the `TargetInvocationException` because the latter usually is caused by the former. – Adwaenyth Aug 08 '17 at 09:22
  • Check if this helps: https://stackoverflow.com/questions/9509779/targetinvocationexception-was-unhandled-c-sharp (Possible duplicate) – crazyGamer Aug 08 '17 at 09:49
  • make sure that action is being fired after the form has been fully created or shown. eg, after initialise component at least, try it in the form load event rather than in the constructor. – WraithNath Aug 08 '17 at 10:28

0 Answers0