Wrox Programmer Forums
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 26th, 2005, 01:45 PM
Authorized User
 
Join Date: Jun 2003
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing data between forms

Can anyone tell me how to pass data from one control on a form to a different form?

Thanks

Renee C. Walker
__________________
Renee C. Walker
 
Old January 26th, 2005, 01:53 PM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

are you talking about web forms?
 
Old January 26th, 2005, 03:00 PM
Authorized User
 
Join Date: Jun 2003
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No, window forms.

Renee C. Walker
 
Old February 9th, 2005, 09:15 AM
Registered User
 
Join Date: Feb 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use the session object (cookies) Or use the url to pass data

 
Old February 16th, 2005, 05:48 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Renee,

Usually what you would do is either expose the control you want to manipulate as public so external code can see and change its properties, or expose just the property you wish to modify with a public property on the form.

-Peter
 
Old February 17th, 2005, 08:09 AM
Registered User
 
Join Date: Jul 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to tot2ivn
Default

There is several ways to do so, there is a simple one.

///////////Here is the code
//Form1.cs

public Form2 f2;
Form1()
{
  this.f2.ShowDialog();
  this.f2.f1 = this;
}
------------------------
//Form2.cs

public Form1 f1;

private Form2(Form1 f1)
{
   //Get any info of controls or data from Form1
   // As long as you set them as public
  // variables in Form1
   // so you can retrieve them
}

Hope you'll get it !

The prince of Roma !
 
Old February 17th, 2005, 08:17 AM
Registered User
 
Join Date: Jul 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to tot2ivn
Default

sorry, the Form2 is

private Form2()//as normal instead of

private Form2(Form1 f1) //wrong



The prince of Roma !





Similar Threads
Thread Thread Starter Forum Replies Last Post
passing data on multiple forms dzisaacs C# 2 December 6th, 2007 02:03 PM
Passing Parameters Between Two Forms sjf905 C# 2 January 13th, 2007 10:44 PM
Passing data between forms pactite Access 5 June 4th, 2005 03:02 PM
Passing values between forms alok992 C# 1 April 28th, 2004 04:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.