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(); } }
private void button7_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(TxtID.Text.Trim()) == false) { Engine.idcustomer = int.Parse(TxtID.Text); Engine.SCustumer(); LblCustomerName.Text = Engine.NameCustomer; LblCustomerAddress.Text = Engine.AddressCustomer; TxtIDPro.Focus(); } } catch (Exception error) { MessageBox.Show("Error : " + error); } }