Step 1: Click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "TransferInformationExample" and then click OK
Step 2: Design your form as below
Form1

Form2

Step 3: Add code to handle your windows forms as below
Form1
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 TransferInformationExample
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnRetrieve_Click(object sender, EventArgs e)
{
//Open form 2, then retrieve value
using(Form2 frm = new Form2())
{
if (frm.ShowDialog() == DialogResult.OK)
txtValue.Text = frm.GetValueInForm2;
}
}
}
}
Form2
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 TransferInformationExample
{
public partial class Form2 : Form
{
//Get value from textbox
public string GetValueInForm2
{
get
{
return txtValue.Text;
}
}
public Form2()
{
InitializeComponent();
}
}
}
VIDEO TUTORIALS