here i have example of what i want in vb.net but i want in c # can any body help pliz
txt1.Text = "Morning"
Form2.TextBox1.Text = txt1.Text
Form2.ShowDialog()
Form2.TextBox1.Text = txt1.Text
Form2.ShowDialog()
have tried this but didnt work
//txt1 from form1
// txt2 from Form2
txt1.Text = "Morning"
Form2 frm2 = New Form2()
frm2.txt2.Text= txt1.text
frm2.ShowDialog()
Vicky BhattPosted Aug 18, 2015, 2:56 AM
Carlos kambuiPosted Aug 17, 2015, 10:39 AM
Vicky BhattPosted Aug 17, 2015, 10:11 AM
Send Value using Object.
Step 1.
Add two forms to your solution and name it as "Form1.cs" and "Form2.cs" respectively.
Step 2.
We will send Form1 TextBox value to Form2 Label Control.
So, Add one TextBox and a Button on Form1 and a Label on Form2.
Step 3.
Open From2.Designer.cs File.
Step 4.
Replace this line "private System.Windows.Forms.Label label1" with "Public System.Windows.Forms.Label label1"
This will make Label1 Public. And we can use it any Form.
Step 5.
Open Form1.cs and Double click on Button.
Step 6.
Write Below code on click event of the button.
You are Done. Debug you application for checking.
Type anything in a TextBox and after that click on button. You will see Form1 TextBox's Text to Form2 Label Control.