private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { var dialog = new MAster.Customer(); dialog.Mode = "updated"; String code = dataGridView1.Rows[e.RowIndex].Cells[custCode.Name].Value.ToString(); var drow = DataSupport.RunDataSet("Select * from TransportCustomers where custCode = '" + code + "'").Tables[0]; foreach (DataRow row in drow.Rows) { dialog.txtTransport.Text = row["transport"].ToString(); dialog.txtcustname.Text = row["customer"].ToString(); dialog.txtCode.Text = row["custCode"].ToString(); dialog.txtAddress.Text = row["address"].ToString(); dialog.txtcontact.Text = row["contactNo"].ToString(); dialog.txtpostCode.Text = row["postalCode"].ToString(); dialog.txtTin.Text = row["tinNo"].ToString(); dialog.txtDis1.Text = row["discount1"].ToString(); dialog.txtDis2.Text = row["discount2"].ToString(); dialog.txtDis3.Text = row["discount3"].ToString(); dialog.txtDis4.Text = row["discount4"].ToString(); dialog.txtDis5.Text = row["discount5"].ToString(); dialog.txtZone.Text = row["zone"].ToString(); } dialog.txtAddress.ReadOnly = true; dialog.txtcustname.ReadOnly = true; dialog.txtCode.ReadOnly = true; dialog.ShowDialog(); display(); }
private void btnAdd_Click(object sender, EventArgs e) { var dialog = new MAster.Customer(); dialog.txtAddress.ReadOnly = false; dialog.txtcustname.ReadOnly = false; dialog.txtCode.ReadOnly = false; dialog.ShowDialog(); display(); }