Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing codes from dll

Status
Not open for further replies.

TekMem

Programmer
Jul 23, 2004
98
0
0
CA
I have an application, which needs dll and its Function name in order to run my vb.net program (My Program is very simple program which has forms and modules and does all kind of reporting and calculations).

I am not sure how can I convert it into dll and then access it through that application.Need Help.

Thanks
 
I understand that you have some kind of control libary that you want to use in you .net application.
The genereal way to do this is to create add a reference to it from your .net application. You can add references to .NET and COM libaries. Ones you´ve got the reference you can use the public methods as if they where part of your program.
I hope this will give you a start. Pleas be a bit more clear if you want more information...
 
I have an application1, which collects certain activities in oracle table. In order to create reports I have created a very small prog using vb.net. In order to run my program in this application1, I need dll and its functions. Can I convert my program into dll and use its function to create reports through this appliction1.
 
You should then Create a "Class library" project, create you small program in it, then build it. This will create a .dll file.

You must then add a reference to it in you Application1.

How?

As elHollandes said, you must open the Application1 project, then right click on "references" then "Browse". Select you dll file and add it to Application1.

You should be able to use the public classes and methods it contains.

How?

By Writing this a the top of your application1 classes:

Imports DllNameOrNameSpace


or by calling the methods directly :

DllNameOrNameSpace.yourMethod


Hope it help you somehow
 
Thanks for your input. I will try this.
 
Is the DLL you wish to call provided by a third party?

If so the VB Declare statement is the normal way of providing access to functions within an external DLL and it is used in exactly the same way as it was in VB6 although the underlying mechanism is rather different.

You simply declare the function and its dll in a Declare statement and then call this function with the correct parameters.


Bob Boffin
 
Thanks again.
I am not sure how can access my forms (which are performing calculations) from class library projects.
 

In Application1 write some code to pass your data as parameter to methods stored in the dll:


Code:
'somewhere in application1

dllNameOrNameSpace.yourSub(parameter1, parameter2 ...)

'or

youVar = dllNameOrNameSpace.yourFunction(parameter1, parameter2 ...)


the parameters can be anything, forms, datatables, ....


Hope this is what you wanted to know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top