473,407 Members | 2,312 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,407 software developers and data experts.

load form and passing parameters to it

Hi
Does anyone know how could I load a form from another and send some
parameters to it?
Is there a way to identify by name instances of same form?
Thx
Nov 15 '05 #1
6 27000

"Jared" <j.*@globalnet.net> wrote in message
news:bh**********@ls219.htnet.hr...
Hi
Does anyone know how could I load a form from another and send some
parameters to it?
A Form is just like any other class/object in .NET.

Create some private member variables and expose them as
properties with getters/setters.

In your FormA, create FormB and set the properties, and then
Show() the form.
Is there a way to identify by name instances of same form?


No. This is not VB6. There are types/objects and instances
of types/objects.

When you create an instance of FormB,you must maintain that
reference just like any other object, if you wish to call
methods, get/set properties, etc in the future.

-c
Nov 15 '05 #2
"Jared" <j.*@globalnet.net> wrote:
Does anyone know how could I load a form
from another and send some parameters to it?


Give your form a new constructor with parameters.

public Form1(string strTitle)
{
// Required for Windows Form Designer support
InitializeComponent();

this.Title = strTitle;
}

P.

--
www.CL4.org
Nov 15 '05 #3
Another option would be to create a parameterized constructor for the form.

Jeremy Wilde

"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message news:3E******************@twister.austin.rr.com...

"Jared" <j.*@globalnet.net> wrote in message
news:bh**********@ls219.htnet.hr...
Hi
Does anyone know how could I load a form from another and send some
parameters to it?


A Form is just like any other class/object in .NET.

Create some private member variables and expose them as
properties with getters/setters.

In your FormA, create FormB and set the properties, and then
Show() the form.
Is there a way to identify by name instances of same form?


No. This is not VB6. There are types/objects and instances
of types/objects.

When you create an instance of FormB,you must maintain that
reference just like any other object, if you wish to call
methods, get/set properties, etc in the future.

-c


Nov 15 '05 #4
to extend a bit:
What does referencing forms means to performance and
memory consumption? (If I have 10 forms loaded at once,and each of them
references one form and one or more classes,does this mean that each
referenced form and class is loaded into memory?)
Nov 15 '05 #5

"Jared" <j.*@globalnet.net> wrote in message
news:bh**********@ls219.htnet.hr...
to extend a bit:
What does referencing forms means to performance and
memory consumption? (If I have 10 forms loaded at once,and each of them references one form and one or more classes,does this mean that each
referenced form and class is loaded into memory?)


If you have instances of a class or form created, then yes,
they take up memory.

Depending on how large your forms or classes are, this isn't
a lot of memory, really. Most classes are pretty small in
size. Forms are pretty small as well unless you have a lot
of embedded images and whatnot.

-c
Nov 15 '05 #6
Chad Myers <cm****@N0.SP.4M.austin.rr.com> wrote:
A Form is just like any other class/object in .NET.


It always amazes me the number of people who just don't seem to get
this. Personally I think the problem is that people dive straight into
Windows Forms without learning the basics first. I always recommend
learning a new language in the simplest way possible - which in C# is
by writing console apps. I'm sure if more people wrote console apps and
"played" with the language (and libraries) that way, they'd be less
confused when learning Windows Forms later.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #7

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

Similar topics

5
by: isaacrajan | last post by:
Hello, I have a form A in my ADP project. The record source of A has input parameters. I need to open form A from three different forms X, Y and Z. When I open A from form X, I want it to...
2
by: Andrew Chanter | last post by:
I am developing my first ADP client for a SQL db, after having used mdb's as clients in numerous applications previously. I have found that theoretically the Input Parameters property of a form in...
2
by: Martin Maat | last post by:
Hi, I am trying to create a plug-in assembly without the need to register it in the GAC. Reflection should help me out here. I got this far: private void button1_Click(object sender,...
0
by: Frank 'Olorin' Rizzi | last post by:
Hello everyone. This is quite convoluted, but I'll try to make it simple. I have a couple of bottom-line questions (I guess): 1~ what happens between the Page_Load routine in the code behind...
1
by: Reza Nabi | last post by:
Bakground: I have a webform (LoadCtl.aspx) which loads the user control to a placeholder dynamically based on the ctlName querystring passed in the URL. Webform (LoadCtl.aspx) also passes a...
4
by: MicroMoth | last post by:
Hi, I'm trying to write a update method, in which when the user clicks the update button the update method is passed 10 form fields. Then a update SQL is run to update the database. My question...
2
by: Jerry Spence1 | last post by:
One way of passing data to a thread is to encapsulate the thread inside a class. However, I can't refer to my main form objects from within the class/thread as it says "Reference to a non-shared...
10
by: sara | last post by:
Hi - I have been struggling with solution ideas for this now for almost 2 weeks, and have not been able to figure this out. I have a user who creates a Purchase Order (tblPOData). In some...
2
by: pat.saunders | last post by:
Hi, I am using Visual Studio 2005 and am using Visual C#. I notice that the program.cs creates an instance of a form and runs it. I have a PictureBox in the form and a Class File x.cs and in the...
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: 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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.