Non-persistent annoying message
-
30-04-2021 - |
سؤال
Annoying message from time to time on my .Net application start appears just after splash screen disappears:
System.InvalidOperationException: Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
I don't know how to fix this type of exceptions and why it appears?
Any help will be appreciated.!
المحلول
This problem usually happens if you add code to the constructor of a form/control, since at that time it isn't linked to a windows control handle. If you have added extra code here, try moving it to OnLoaded
or similar.
نصائح أخرى
It seems you are trying to invoke a method belonging to a class instance as not previously created, make sure that the invocations of methods or functions of classes or objects after a re made explicit initialization.
Call myClass_Method 'or myObject_method
myClass as <objecttype> = New <objecttype>
Make sure it is as follows:
myClass as <objecttype> = New <objecttype>
Call myClass_Method 'or myObject_method
That I guess since you do not give more details or code samples