Zeb Rehman

Zeb Rehman

  • NA
  • 69
  • 54k

Passing value between form in windows form

Mar 12 2012 4:30 AM
Hi friends,
I want to send a link which is stored in a string variable to another form. please tell me how can i code it.

Answers (2)

0
Senthilkumar

Senthilkumar

  • 0
  • 10.8k
  • 4m
Mar 12 2012 4:47 AM
Hi,

You can send the value as arqument.

Form2 frm2 = new Form2(this.textBox1InForm1.Text);
frm2.ShowDialog();

In the form2, you need to write the constructor.

 public Form2(string strParam)
 { 
 InitializeComponent();
 this.textBox1_InForm2.Text=strParam;
 }



Please refer these link. 

http://www.c-sharpcorner.com/UploadFile/thiagu304/passdata05172006234318PM/passdata.aspx
http://www.c-sharpcorner.com/UploadFile/alindag/HowToPassValuesBetweenWindowsForms.htm02242006061520AM/HowToPassValuesBetweenWindowsForms.htm.aspx


I
f it is useful then mark it as Accept answer.


Accepted Answer
0
Zeb Rehman

Zeb Rehman

  • 0
  • 69
  • 54k
Mar 12 2012 5:56 AM
Thanks brother Kumar