Hi guys!
i'm using Visual Studio 2005 C#.
I like to ask this question about GUI.
How can i pass value from one form to another?
For example, the user have to key-in the amount of money he/she needs to borrow in form1.cs
Then on form2.cs, i need to get the value the user keyed-in in form1 and multiply by the interest rate and show the amount of interests he needs to pay on form2.cs
Did i confuse you guys?
Please help me! Tks for the help! =)

Hi,
Assume u get input in Form1.textBox1 and u display the amount of interest in Form2.textBox1.
I give simple example this will help u
> Create Two Forms namely Form1, Form2
> In form1 Draw one TextBox (textBox1), and Button (button1)
>In Form2 Draw one TextBox (textBox1)
>Change textBox1 Modifier Property to Public in Form2
In Form1 button_Click()

private void button1_Click(object sender, System.EventArgs e)
	{
		Form2 NextForm = new Form2 ();
		NextForm.textBox1.Text = textBox1.Text ;
		NextForm.Show();
	}

But this NextForm exists temporarily. Once u closed NextForm u lost the value

Hi,
Assume u get input in Form1.textBox1 and u display the amount of interest in Form2.textBox1.
I give simple example this will help u
> Create Two Forms namely Form1, Form2
> In form1 Draw one TextBox (textBox1), and Button (button1)
>In Form2 Draw one TextBox (textBox1)
>Change textBox1 Modifier Property to Public in Form2
In Form1 button_Click()

private void button1_Click(object sender, System.EventArgs e)
	{
		Form2 NextForm = new Form2 ();
		NextForm.textBox1.Text = textBox1.Text ;
		NextForm.Show();
	}

But this NextForm exists temporarily. Once u closed NextForm u lost the value

Hi!
Tks for the help!
But if i don't want to create button, is there any other way?
Actually I'm working on this project, which uses GUI and there's actually no button for it.
Just a Tree view at the side. So when the user click on the tree view, the value passes from one place to another.

hi,

you can use Session, withn the help of session you can pass your value to any page in your project. it work like this..

Session["value']=textbox1.text.tostring

now you can access these value to another page.
like
string a=Session["value"].

Tks for the help guys!
i sloved the problem already!
really tks for the help! :)

Tks for the help guys!
i sloved the problem already!
really tks for the help! :)

Oh. it was solved...
then please share your answer friend, so other members can learn from u if they got same problem. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.