Drag one textbox and button
In Button click event at Form1.cs
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Form2 form = new Form2(textBox1.Text);
form.Show();
}
}
Form2.cs(design)
Label
Form2.cs:
public Form2(string strtextbox)
{
InitializeComponent();
label1.Text = strtextbox;
}
at program .cs write a code below
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
I hope it will help you when you send the data from one form to another form using c#.net