public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 f = new Form2();
f.ShowDialog();
textBox1.Text = (!string.IsNullOrEmpty(f.postID)) ? f.postID : textBox1.Text;
}
}
//Form2 Code (C#)
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public string postID = "";
private void Form2_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'dATA_ALSDataSet.DataTable1' table. You can move, or remove it, as needed.
this.dataTable1TableAdapter.Fill(this.dATA_ALSDataSet.DataTable1);
}
private void dataTable1DataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
postID = this.dataTable1DataGridView[1, e.RowIndex].Value.ToString();
Close();
}
private void button1_Click(object sender, EventArgs e)
{
dataTable1BindingSource.Filter = "PostCode like '%" + textBox1.Text + "%' OR Post_Province like '%" + textBox1.Text + "%' OR Post_Amphur like '%" + textBox1.Text + "%' OR Post_PostOffice like '%" + textBox1.Text + "%'";
}
}