home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

using DLL's with vb.net

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1863
Discussions: 200,935, Posts: 2,379,205, Members: 246,300
Old November 2nd, 2004, 10:35 PM   Digg it!   #1 (permalink)
Member
 
Join Date: Oct 2003
Posts: 263
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: 263
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: 263
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: 263
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: 263
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: 263
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2889)
Wireless Televisions. (6)
California Passes Anti-Flat-HDTV Le.. (39)
Obama the Muslim (14)
Is the PSU I received dead? (10)
windows vista security holes (9)
Install XP pro and a Vista laptop ?.. (11)
HIS HD5770 graphic card question (15)
Print spooler problem (13)
Foreign voltage (10)
Dept. of HS: NSA 'Helped' Develop V.. (15)
A good PSU? (10)
EVGA 9800 gtx help with finding a g.. (8)
New Computer wont recognize XP disc (7)
Recent Discussions
windows 7 problem (0)
wireless user (0)
Modern Warfare 2 freeze (12)
Wireless Televisions. (6)
CPU fan stops spinning randomly (2)
World's largest Monopoly Game using G.. (332)
Ideal cheap graph card for PC-Gaming? (17)
BIOS won't read disk when I try to fl.. (0)
Install XP pro and a Vista laptop ?? (11)
Partition Magic caused HDD problem (2)
Graphics Card Upgrade Question (1)
favorit (1)
solutions for virtical white lines on.. (1)
Regular Build (3)
Fire in DVD (2)
Modern Warfare For the PC (33)
radeon x850xt platinum & shader 3 (3)
Have you switched yet? (84)
Wireless Router+Cable Modems and Much.. (0)
Optical Audio A-B Switch (1)
windows vista security holes (9)
The NTDVM CPU has encountered an ille.. (24)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (34)
Wireless speakers for PC? (11)
Print spooler problem (13)


All times are GMT -4. The time now is 10:27 AM.
TechIMO Copyright 2009 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