0

plz tell me .....how can i put the textboxes values of form 1...itni form2 textboxes at load time.....?

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by sadaf K
0

Hello Sadaf,

Here's an example:

Use this when opening Form2:

Form2 form2 = new Form2(textBox1);
form2.Show();

Edit form2 and make it like this:

TextBox txtBox;
public Form2(TextBox txtBox)
{
  InitializeComponent()

  this.txtBox = txtBox;
}

// Now you can get form1's textbox text like this

private void button1_click(object sender, EventArgs e)
{
    MessageBox.Show(txtBox.Text);
}

Thanks

Edited by farooqaaa: n/a

0

plz tell me .....how can i put the textboxes values of form 1...itni form2 textboxes at load time.....?

hi also u can make it a private variable and call it from a method

in form 1 (frmOne)

private String val="":

val = textbox1.text;

public void getVal()
{
return val;
}

in the second form

frmOne f1 = new frmOne();
textbox1=text = f1.getVal();


hope you understood this

i am not sure on which one is the best,

farooqaa or this,


thanxxxx

0

thanks to farooqaaa...nd judithsampathwa.....

farooqa ones useful for me...n ive solved my problem....but i'll try also urs

thanxx to all

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.