public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click_1(object sender, EventArgs e)
{
Form2 f = new Form2();
f.Show();
}
}
Code (C#)
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
listBox1.Items.Add("1");
listBox1.Items.Add("2");
}
private void button1_Click(object sender, EventArgs e)
{
Form1 f = new Form1();
f.label1.Text = listBox1.Text;
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click_1(object sender, EventArgs e)
{
Form2 f = new Form2();
f.strVal = listBox1.Text;
f.Show();
}
}
Code (C#)
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public string strVal = string.Empty;
private void Form2_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
label1.Text = strVal;
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Form2 f = new Form2();
private void button1_Click_1(object sender, EventArgs e)
{
f.strVal = listBox1.Text;
f.Show();
}
}
Code (C#)
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public string strVal = string.Empty;
private void Form2_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
label1.Text = strVal;
}