473,383 Members | 1,853 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,383 software developers and data experts.

How to make a form of main application reuseable by others?

Hi, I'm using vs2005, .net 2.0, Win2k server for a Windows applcaiton. I
have a main application where there is a a form and the codes that I would
like to make it reuseable by other applications.
1. I already have a classlibray project but I don't think I can include a
"form" in it, right?
2. So, do I make this form into a dll so other application can include it
as a reference?
3. To do the item 2, does that mean that I would create a new project and
add the form and the code in it. But how to specify to generate a dll
instead of a project that produce .exe file after it's compiled?
Thank you.
--
Thanks.
Apr 13 '07 #1
3 1572
Pucca,

You can definitely include a form in a class library. A form is nothing
more than a class. All you have to do is make sure the form is public. You
might want to consider whether or not there are menus on the form, if it is
used as a child form, then it will not take to nicely, depending on how
menus on the parent form are used.

All you have to do is create a "Class Library" project and then you can
add your form code to it, and then reference it from other applications.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:BC**********************************@microsof t.com...
Hi, I'm using vs2005, .net 2.0, Win2k server for a Windows applcaiton. I
have a main application where there is a a form and the codes that I would
like to make it reuseable by other applications.
1. I already have a classlibray project but I don't think I can include
a
"form" in it, right?
2. So, do I make this form into a dll so other application can include it
as a reference?
3. To do the item 2, does that mean that I would create a new project and
add the form and the code in it. But how to specify to generate a dll
instead of a project that produce .exe file after it's compiled?
Thank you.
--
Thanks.

Apr 13 '07 #2
Yes a form is simply a class that has derived from the "Form" class.
This form can be duplicated as many times as you want by creating
multiple instances of the class. Once your form is declared "public"
then your other applications can link to the DLL as a reference and
use it in:

MyForm myForm = new MyForm();
MyForm.ShowDialog();

or

Application.Run(new MyForm());

both of which work well. But the latter is used for initiating the
MAIN form only while the former may be used to show an independent
form.

Remember that to change from "exe" to "dll" simply change the
application type from Windows Application to Class Library in the
project properties part.

Freiddie
http://fei.yuanbw.googlepages.com/
http://freiddy.blogspot.com/
http://crazibe.blogspot.com/

Apr 13 '07 #3
Thank you both for the help. I will now try to do that.
--
Thanks.
"Nicholas Paldino [.NET/C# MVP]" wrote:
Pucca,

You can definitely include a form in a class library. A form is nothing
more than a class. All you have to do is make sure the form is public. You
might want to consider whether or not there are menus on the form, if it is
used as a child form, then it will not take to nicely, depending on how
menus on the parent form are used.

All you have to do is create a "Class Library" project and then you can
add your form code to it, and then reference it from other applications.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:BC**********************************@microsof t.com...
Hi, I'm using vs2005, .net 2.0, Win2k server for a Windows applcaiton. I
have a main application where there is a a form and the codes that I would
like to make it reuseable by other applications.
1. I already have a classlibray project but I don't think I can include
a
"form" in it, right?
2. So, do I make this form into a dll so other application can include it
as a reference?
3. To do the item 2, does that mean that I would create a new project and
add the form and the code in it. But how to specify to generate a dll
instead of a project that produce .exe file after it's compiled?
Thank you.
--
Thanks.


Apr 13 '07 #4

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

Similar topics

14
by: BOOGIEMAN | last post by:
Well that's it, how do I make Windows Application with Python ??? Is there simple way that works 100% ? How can I rework visual design done in VS 2003 to use it for my python program ?
8
by: Emily Jones | last post by:
Very strange one this. Application written in Access 2000. Runs in 2003 at client's site, 2000 on my development system. FE/BE system. The app's startup form sets a few options, opens the...
3
by: Chris | last post by:
Hi, I'm trying to append text from another class to a generic richTextBox that I've added to a Windows form. I can't seem to figure out how to expose the richTextBox to append text to it. ...
0
by: Emmanouel | last post by:
Hello everybody, I have a program that i would like to run as a system tray application. This means that i do not need the main form to appear. I found in net help that : “To make the main...
2
by: John Granade | last post by:
I'm looking for the best way to make a dataset available from multiple Windows forms. The dataset is created from an XML file. I have a main form (frmMain) that loads the dataset and reads the...
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
2
by: zefciu | last post by:
In the tutorial there is an example iterator class that revesrses the string given to the constructor. The problem is that this class works only once, unlike built-in types like string. How to...
1
by: Mohit | last post by:
Hi all, I am working on a windows based client server application with multiple forms. All forms are having custom title bars with no default bars. There is one main form. Some forms are opened up...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.