home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 1764
Discussions: 188,403, Posts: 2,243,609, Members: 232,631
Old November 2nd, 2004, 10:35 PM   Digg it!   #1 (permalink)
Member
 
Join Date: Oct 2003
Posts: 255
using DLL's with vb.net

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.

amtrac24 is offline   Reply With Quote
Old November 5th, 2004, 12:42 AM     #2 (permalink)
Member
 
Join Date: Sep 2002
Posts: 364
Add a reference to it

Creosote is offline   Reply With Quote
Old 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

amtrac24 is offline   Reply With Quote
Old 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()
Creosote is offline   Reply With Quote
Old 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.
amtrac24 is offline   Reply With Quote
Old November 6th, 2004, 12:03 AM     #6 (permalink)
Member
 
Join Date: Oct 2003
Posts: 255
another ?

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.
amtrac24 is offline   Reply With Quote
Old 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.
Creosote is offline   Reply With Quote
Old 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.
amtrac24 is offline   Reply With Quote
Old July 11th, 2008, 11:57 AM     #9 (permalink)
Junior Member
 
Join Date: Jul 2008
Posts: 1
Send a message via Yahoo to venmic Send a message via Skype™ to venmic
Talking
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 View Post
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.
venmic is offline   Reply With Quote
Old July 11th, 2008, 10:49 PM     #10 (permalink)
Member
 
Join Date: Oct 2003
Posts: 255
try

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()
amtrac24 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
System File Checker in Win98 TOAD6147 General Tech Discussion 9 January 3rd, 2009 04:25 AM
Sharing a DLL file galehickey General Tech Discussion 3 October 27th, 2004 04:36 PM
What the hell is CRYPTNET.DLL???? Namie Technical Support 13 December 26th, 2003 08:31 PM
Visual Basic .Net - DLL file question firewolf Applications and Operating Systems 15 September 17th, 2003 11:25 PM
asx MaKwade Applications and Operating Systems 4 November 22nd, 2002 07:16 AM

Most Active Discussions
Is It Just Me? (2906)
Unarmed man on his stomach shot by .. (6)
Misery Loves Company... (2144)
New Build ( Finally ) (7)
CPU wont boot (7)
Building a gaming computer advice (5)
I think I just killed my computer w.. (24)
RCA 52Inch HDTV wont turn on (5)
Folderchat Weekday thread (444)
Recent Discussions
Please help! multiple problems! (4)
How to transfer music from iPod.. (0)
RCA 52Inch HDTV wont turn on (5)
New Build ( Finally ) (7)
Common Spyware Solutions (97)
How do you move a hard-drive to.. (4)
Laptop proccesor to desktop mob.. (1)
What is the best external enclo.. (0)
Partition Magic 7.0 (Unallocate.. (17)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 03:57 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28