Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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 13th, 2007, 12:08 AM
Authorized User
 
Join Date: Sep 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing Parameters Between Two Forms

Hello, I have one main form with a text box that needs to be filled by a parameter from a second form (which opens on a button click in form1). Right now I have something that looks like this:

//in form1
private void button1_Click(Object sender, EventArgs e) {
   form2 f2 = new form2();
   f2.Show();
   //looks like I need some kind of system pause here...
   //I tried a system pause and a Console.ReadLine, to no avail
   textBox1.Text = f2.param.ToString();
}

The problem is that f2.param fills the textBox right away, before it can be retrieved from the user on form2. If its not obvious, I'm a little new to C#.
Thanks for the help.
 
Old January 13th, 2007, 02:50 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

For one thing, it sounds like you might want to be using the ShowDialog method of fr:

f2.ShowDialog();



Woody Z
http://www.learntoprogramnow.com
 
Old January 13th, 2007, 10:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

There is another similar topic that may be of interest.
http://p2p.wrox.com/topic.asp?TOPIC_ID=54689


======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================





Similar Threads
Thread Thread Starter Forum Replies Last Post
passing parameters fizzerchris Access VBA 5 August 31st, 2007 12:16 PM
Passing parameters tal Ajax 5 May 26th, 2007 08:07 AM
Passing parameters ceema Crystal Reports 0 February 15th, 2006 04:03 AM
Access Forms Open Method of Passing Parameters androman Access VBA 8 September 22nd, 2004 09:04 AM
passing parameters spraveens Javascript How-To 1 October 8th, 2003 03:14 AM





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