private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { var dr = dataGridView1.SelectedRows[0]; Hide(); var frm = new frmCustomers(); frm.Show(); frm.txtCustomerID.Text = dr.Cells[0].Value.ToString(); frm.txtCustomerName.Text = dr.Cells[1].Value.ToString(); frm.txtAddress.Text = dr.Cells[2].Value.ToString(); frm.txtCity.Text = dr.Cells[4].Value.ToString(); frm.txtLandmark.Text = dr.Cells[3].Value.ToString(); frm.cmbState.Text = dr.Cells[5].Value.ToString(); frm.txtZipCode.Text = dr.Cells[6].Value.ToString(); frm.txtPhone.Text = dr.Cells[7].Value.ToString(); frm.txtEmail.Text = dr.Cells[8].Value.ToString(); frm.txtMobileNo.Text = dr.Cells[9].Value.ToString(); frm.txtFaxNo.Text = dr.Cells[10].Value.ToString(); frm.txtNotes.Text = dr.Cells[11].Value.ToString(); frm.btnUpdate.Enabled = true; frm.btnDelete.Enabled = true; frm.btnSave.Enabled = false; frm.txtCustomerName.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message, "ล้มเหลว", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmCustomersRecord1_FormClosing(object sender, FormClosingEventArgs e) { Hide(); var frm = new frmCustomers(); frm.Show(); }
private void profileEntryToolStripMenuItem_Click(object sender, EventArgs e) { var frm = new frmCustomers(); frm.Show(); }