Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Problem in transfering data from one form to another form?
 

Problem in transfering data from one form to another form?

hi friends,

In my program, i need to transfer a data from one form to another form(i.e. from textbox to label in another form).
i wrote the code, it was correct no errors, but the data has not been transferred?

please help me

premever  Saturday, April 18, 2009 8:11 AM
Hi Premever,

Could you tell us how you transfer data from Form1 to Form2? My suggestion is to write a public method on Form2 that accepts data and call this method from Form1.

> i wrote the code, it was correct no errors, but the data has not been transferred?

It seems like that you don't refer to the correct instance of the form that accepts the data.

Sincerely,
Linda Liu
Linda Liu  Thursday, April 23, 2009 9:46 AM
Please post your code here....Without code it is difficult to help...
Amit Bansal  Wednesday, April 22, 2009 10:24 AM
Hi Premever,

Could you tell us how you transfer data from Form1 to Form2? My suggestion is to write a public method on Form2 that accepts data and call this method from Form1.

> i wrote the code, it was correct no errors, but the data has not been transferred?

It seems like that you don't refer to the correct instance of the form that accepts the data.

Sincerely,
Linda Liu
Linda Liu  Thursday, April 23, 2009 9:46 AM
public Form1: Form
{
public void button1_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2();
form2.Value = textBox1.Text;
}
}

public Form2: Form
{
public String Value { get; set; }
public void Form2_Load(object sender, EventArgs e)
{
label.Text = Value;
}
}
Thanks, A.m.a.L | [Remember to click "mark as answered" when you get a correct reply to your question]
A.m.a.L - aditi.com - Think Product  Thursday, April 23, 2009 9:57 AM

You can use google to search for other answers

Custom Search

More Threads

• How can I hide MainMenu in VS2003 Designer
• Opening a form in .NET 2005
• Custom constructors with types from separate project breaks winforms designer (VS2010)
• VS.NET Toolbox
• Nested Parentable Control
• drawing a table in C#
• Defining where 'child' controls can be placed
• having cancel button in windows program problems
• docking during design
• How to update data