473,378 Members | 1,236 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Call DLL from a Windows form

I have created a class library say, EmployeeDataDLL.dll. This is a data
access to the backend database.

How do I create an object of the class inside this dll from a Windows form ?


Jun 28 '06 #1
2 2374
Alan,
There are basically 3 simple steps here:

1) set a Reference to the Assembly (or a Project Reference, preferably, if
the project of the DLL is in your Solution) using the References Node from
Solution Explorer.
2) create a using "myNameSpace.MyClass" directive at the top of your Form
class (not required, but eases the semantics of addressing your class)

3) create an instance with :

MyClass myInstance = new MyClass();
At this point, public methods of the "myInstance" class instance variable
may be used.

Hope that clarifies.
--Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Alan" wrote:
I have created a class library say, EmployeeDataDLL.dll. This is a data
access to the backend database.

How do I create an object of the class inside this dll from a Windows form ?


Jun 29 '06 #2
So I need to include the project of DLL in the Windows Form solution ?

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:91**********************************@microsof t.com...
Alan,
There are basically 3 simple steps here:

1) set a Reference to the Assembly (or a Project Reference, preferably, if
the project of the DLL is in your Solution) using the References Node from
Solution Explorer.
2) create a using "myNameSpace.MyClass" directive at the top of your Form
class (not required, but eases the semantics of addressing your class)

3) create an instance with :

MyClass myInstance = new MyClass();
At this point, public methods of the "myInstance" class instance variable
may be used.

Hope that clarifies.
--Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Alan" wrote:
I have created a class library say, EmployeeDataDLL.dll. This is a data
access to the backend database.

How do I create an object of the class inside this dll from a Windows
form ?


Jun 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David N | last post by:
Hi All, I just wonder if in C#, I can develop a user defined control that can call its parent function which is not yet developed. For example, how do I make my user control call a...
2
by: PawelR | last post by:
Hello Group, In my application I have few class, and I want call function with "master class". This is as master form (startClass) and option window (ClassA). My question is how call function...
10
by: Clint | last post by:
Hey all - I'm having a really confusing problem concerning a web service. Right now, I have an application that needs to call a web service that does nothing but return "true" (this will...
9
by: Martin | last post by:
Hi all We are new to coding in VB after many years COBOL (yes i know!!!). Anyway esentially we are trying to have a simple .exe program that will call relevant .dll's when required. The...
0
by: Nickneem | last post by:
I' m trying to disable all right mouse clicks by using the vbAccelerator Windows Hooks Library The small (systray / console) app. must catch all (right) mouseclicks before they are received by...
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
1
by: Martijn Mulder | last post by:
Documentation suggests that I should make a call to the base-class method for some methods. When I try to do so for the class below, I get wrong results. What is the correct way to make a call to...
7
by: Sheikko | last post by:
Hi all, i have an application and i wan to call another program into it, like notepad, so when i minimize the notepad, or maximize, it must rest in my application. thank you
8
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query...
7
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I am trying to see if I can call a Library remotely. The library contains a Form that I want to display then pass back some data to user that called this form remotely. I have it working...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.