MffM
12-11-2006, 11:43 AM
Hi all
i have a project in vb.net 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) so i did this and called the begininvoke method in the load procuder of my form and this what i have written
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim method As System.Delegate
Dim returnValue As IAsyncResult
returnValue = Me.BeginInvoke(method)
End Sub
i know there is something missing what is it i need a code exampe please
thanks in advance:)
i have a project in vb.net 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) so i did this and called the begininvoke method in the load procuder of my form and this what i have written
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim method As System.Delegate
Dim returnValue As IAsyncResult
returnValue = Me.BeginInvoke(method)
End Sub
i know there is something missing what is it i need a code exampe please
thanks in advance:)