private void button1_Click(object sender, EventArgs e) { SearchCustomer SearchCus = new SearchCustomer(); SearchCus.ShowDialog(); if (SearchCus.DialogResult == DialogResult.OK) { TxtIDCli.Text= SearchCus.dataGridView1.Rows[SearchCus.dataGridView1.CurrentRow.Index].Cells[0].Value.ToString(); TxtNaCli.Text = SearchCus.dataGridView1.Rows[SearchCus.dataGridView1.CurrentRow.Index].Cells[1].Value.ToString(); TxtAdCli.Text = SearchCus.dataGridView1.Rows[SearchCus.dataGridView1.CurrentRow.Index].Cells[2].Value.ToString(); } }
private void BtnCustomer_Click(object sender, EventArgs e) { SearchCustomer SearchCus = new SearchCustomer(); SearchCus.ShowDialog(); if (SearchCus.DialogResult == DialogResult.OK) { TxtID.Text = SearchCus.dataGridView1.Rows[SearchCus.dataGridView1.CurrentRow.Index].Cells[0].Value.ToString(); LblCustomerName.Text = SearchCus.dataGridView1.Rows[SearchCus.dataGridView1.CurrentRow.Index].Cells[1].Value.ToString(); LblCustomerAddress.Text = SearchCus.dataGridView1.Rows[SearchCus.dataGridView1.CurrentRow.Index].Cells[2].Value.ToString(); TxtIDPro.Focus(); } }