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.
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.
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