How to call DoEvents in a class file? The project is compiled into a DLL and the class has no access to any forms.
Printable View
How to call DoEvents in a class file? The project is compiled into a DLL and the class has no access to any forms.
You can call it from a module in the app like ... Application.DoEvents, but I am not 100% sure about inside a dll?
When I write Application.DoEvents() I get an error:
Name 'Application' is not declared.
Application.DoEvents() raises all pending events for the current application. It is a Shared method of the Application class, so no object reference is needed. Note that the Application class is a member of the System.Windows.Forms namespace, so your project must have a reference to the appropriate library. A Windows Control Library project will have that reference by default, but I think you'd have to add it yourself if your's is a Class Library project.
Imports System.Windows.Forms
Namespace or type 'Forms' for the Imports 'System.Windows.Forms' cannot be found.
I said you have to add a reference to your project. You cannot import a namespace for which you do not have a reference to its library.Quote:
Originally Posted by itportal
The DLL and the main project (where the exe file is) are different projects. The EXE has a refrence to the DLL, but how to link the DLL with the EXE?
That's not what I meant. I meant that you need to right-click your DLL project in the Solution Explorer, select Add Reference, then select System.Windows.Forms.dll from the .NET tab. This will add a reference to that assembly, which contains the System.Windows.Forms namespace and thus the System.Windows.Forms.Application class, to your DLL project. Then you can import the System.Windows.Forms namespace if you want and access all its members.
Note that importing a namespace only means you don't have to qualify the names of its members in your code. It doesn't give you access to anything that you didn't have before.
Sorry, I haven't understand you right ;) It worked. Thanks a lot!
All's well that works well. :)