InvalidOperationException was unhandled

MffM

New member
Joined
Dec 11, 2006
Messages
1
Programming Experience
1-3
Hi all

i have a project in vb.net application some times at run time this message appear

InvalidOperationException was unhandled

{"Invoke or BeginInvoke cannot be called on a control until the window handle has been created."}

i don't know why and i didn't find any logic when it's appear because when i run my project some time its appear and some times it doesn't appear.

i read alot of articals all of them talk about thread and UI
but i didn't use thread in my project , i used alot of select statments, insert and update to the data base , for loops , show forms and show dialogs .

please how can i fix this problems and how can i know where is the problem.

this is the details of the exception

System.InvalidOperationException was unhandled
Message="Invoke or BeginInvoke cannot be called on a control until the window handle has been created."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.Control.MarshaledInvoke(Contr ol caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.BeginInvoke(Delegate method, Object[] args)
at System.Windows.Forms.Label.OnFrameChanged(Object o, EventArgs e)
at System.Drawing.ImageAnimator.ImageInfo.OnFrameChan ged(EventArgs e)
at System.Drawing.ImageAnimator.ImageInfo.set_Frame(I nt32 value)
at System.Drawing.ImageAnimator.AnimateImages50ms()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
note :
in some articals i read about calling the method begininvoke(delegate)

and the others siad
the form is still loading so what you've written in your load event handler is invalid until the form has finished loading.
how can i know that the form finish the loading



thanks in advance
smile.gif
 
Back
Top