Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello
Two forms in program ,private textBox1 in Form1 .I need the value of that
textBox1 in Form2. I do not want to set variable as Public static string in Form1 equal to textBox1.Text,looking for better solution

What I have tried:

//in Form1 textBox1 declared as Public 
//in Form2
string str;
str=Form1.textBox1.Text;
Posted
Updated 18-Feb-24 7:21am

There are some articles about sharing data here at CP.
This is one of them:
Sharing data among Windows Forms[^]
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900