Following is my Form1, Here I am Passing Form1 Textbox value to Form2 TextBox.
I want to send the Form1 Value to Form2 textbox as
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ValuesPassingFromformtoform
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2(textBox1.Text);
f2.Show();
}
}
}This is my Form2, Whenever I clicked on Form1 button, textbox value will send to the Form2's Textbox value.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ValuesPassingFromformtoform
{
public partial class Form2 : Form
{
public Form2(string value)
{
InitializeComponent();
textBox2.Text = value;
}
}
}
No comments:
Post a Comment