November 2nd, 2004, 10:35 PM
|
#1 (permalink)
| | Member
Join Date: Oct 2003
Posts: 255
|
Hi,
I have created some dll funtions and sub procedures. The problem is I tried to run them from a vb.net application and really havent got anywhere. I searched the web but couldnt find anything. Anyone know how to run a custom dll that i created in a vb.net application?
Thanks for your help. |
| |
November 5th, 2004, 12:42 AM
|
#2 (permalink)
| | Member
Join Date: Sep 2002
Posts: 364
| |
| |
November 5th, 2004, 12:56 AM
|
#3 (permalink)
| | Member
Join Date: Oct 2003
Posts: 255
|
once i add a reference to it I can just call it from a sub?
Run_DLL ()
I tried to create an easy example just so I can see how it works. I created a dll that pops up a message box.
However when i run it i get an error such as this
system.entrypointnotfoundexception
Unable to find an entry point named DLL_Run in DLL Test
Any suggestions...
I use the Public Declare Auto Sub DLL_Run Lib "DLL Test" () to declare the dll |
| |
November 5th, 2004, 09:47 PM
|
#4 (permalink)
| | Member
Join Date: Sep 2002
Posts: 364
|
No, you have to declare an instance of it. Maybe it contains a library called DoStuff. Then you say Code: Dim ds As New DoStuff()
ds.DoSomething() |
| |
November 5th, 2004, 11:31 PM
|
#5 (permalink)
| | Member
Join Date: Oct 2003
Posts: 255
|
o man, your awesome. I got it to work. Thank you sooo much for your help...It actually makes sense now. |
| |
November 6th, 2004, 12:03 AM
|
#6 (permalink)
| | Member
Join Date: Oct 2003
Posts: 255
|
Hey,
Got a couple more questions in regards to .dll.
What is the difference between calling a sub from a .dll and calling it from a . vb module code? Is there any performance gains from either? When you typically write an application what would you include in a .dll and what would you code in a . vb page.
my last question is this. When using an installer with a .dll where do the .dll have to be installed for the .exe to be able to find them? Should they be in the same directory as the .exe?
Creosote: Thank you for all your help. |
| |
November 6th, 2004, 12:48 AM
|
#7 (permalink)
| | Member
Join Date: Sep 2002
Posts: 364
|
I have no idea about the performance of the VB.Net dll's. I would think there would not be much of a difference, since they would both be run through the JIT compiler.
You would typically write a dll if you wanted to create functions that would be re-used. For example, you might create something that has useful calculations that you may want to use in all of your programs. Well, instead of adding the class to each project, you reference your dll.
The setup project should automattically put your dll in the appropriate place. Furthermore, dll's do not have to be registered in VB.Net, thus getting away from "dll hell". For example, you would notice that if you created a VB 6 project, it would register and place dll's in the System32 folder in Windows. |
| |
November 6th, 2004, 10:39 AM
|
#8 (permalink)
| | Member
Join Date: Oct 2003
Posts: 255
|
creosote,
thanks for all your help I really appreciate it. |
| |
July 11th, 2008, 11:57 AM
|
#9 (permalink)
| | Junior Member
Join Date: Jul 2008
Posts: 1
| Need the same help as below
I created a dll with somefunctions and then added it a vb.net application
the dll got added but I am not able to use the same methods i had provided there in the dll
can someone help Quote:
Originally Posted by amtrac24 Hi,
I have created some dll funtions and sub procedures. The problem is I tried to run them from a vb.net application and really havent got anywhere. I searched the web but couldnt find anything. Anyone know how to run a custom dll that i created in a vb.net application?
Thanks for your help. | |
| |
July 11th, 2008, 10:49 PM
|
#10 (permalink)
| | Member
Join Date: Oct 2003
Posts: 255
|
what do you mean you arent able to use??? Can you see the methods?
make sure you added a reference to the vb.net project to the dll.
ie. Your exe reference folder then right click and add a reference.
make sure your class is public in the dll along with public methods (subs, functions). Anything private won't be visible from the application.
Then in your exe create the class as you would if the dll code was in the exe.
If the dll class is called DLLClass and the sub you want to call is Test code the following:
dim objNewClass as new DLLClass
objNewClass.Test() |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | |
Posting Rules
| You may post new threads You may post replies You may not post attachments You may not edit your posts HTML code is Off | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |