Question .DLL Problem

abdul_samad

Member
Joined
Nov 5, 2007
Messages
6
Programming Experience
1-3
Team VB.Net Hi Sir my problem is How can i make .dll file and how can i call in vb.net forms with using data base code. Please help.
 
Last edited by a moderator:
To create a DLL in VB you generally select Class Library or Windows Control Library when creating a new project. They will both compile to a DLL rather than an EXE by default. If you have already created an application project instead of a library project then you can change the output type to Class Library in the project properties and a DLL will be created next time you compile.

To make use of a DLL in VB you need to reference it from your project, just as you do with the DLLs that make up the .NET Framework. If the library project is in the same solution as the application project then you can reference the project, otherwise you must reference the DLL itself.

I can only guess what you mean by this:
with using data base code
Please provide a more complete description of what you want to achieve. For future reference, one sentence is rarely enough to let others know what your problem is. That is almost always more relevant information that you can, and should, provide.
 
answer

very very thanks sir
i wana sey it i make a one project "School Management System" but any seprate form have database connectivity and make new connection all forms are have database connectivity . sir my problem is how can i write database coding in class library. and how can i call .dll file in form. i wana i dont write database coding in any forms. just make a .dll file and use it any form.
thanks team vbdotnetforums
 
You write data-access code in a library project in exactly the same way as you write it in an application project. Code is code wherever you write it.

You'll have to pass the connection string, or at least its properties, into the library from the application. You'll also need to pass in the SQL statements or stored procedure names. If you want your code to be as generic as possible then look at using the DbProviderFactory as the centrepiece.

As for using your library in an application, you already do that all the time. Every type you use from the .NET Framework is defined in a DLL. Once you've added a reference to that DLL to your project it's all the same.
 
Back
Top