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

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

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

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

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

thanxx to all

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.