void ClearData() { ID_RESERVATION.Clear(); AMOUNT.Clear(); DATE_RESERVATION.Clear(); MODEL_NAME.Clear(); RENTAL_DAYS.Clear(); }
private void button2_Click(object sender, EventArgs e) { ClearData(); PL.Reservation_list frm = new PL.Reservation_list(); frm.ShowDialog(); this.ID_RESERVATION.Text = frm.dataGridReservation.CurrentRow.Cells[0].Value.ToString(); this.DATE_RESERVATION.Text = frm.dataGridReservation.CurrentRow.Cells[1].Value.ToString(); this.MODEL_NAME.Text = frm.dataGridReservation.CurrentRow.Cells[4].Value.ToString(); this.RENTAL_DAYS.Text = frm.dataGridReservation.CurrentRow.Cells[2].Value.ToString(); AMOUNT.Focus(); }
public string this[string columnName] { get { string result = null; if (columnName == "AMOUNT") { string AMOUNTinString = AMOUNT.ToString(); decimal d; if (!decimal.TryParse(AMOUNTinString, out d)) { result = "Please Enter Currency Value"; } } return(result); } }
private void dataGridReservation_DoubleClick(object sender, EventArgs e) { try { ID_RESERVATION.Text = this.dataGridReservation.CurrentRow.Cells[0].Value.ToString(); AMOUNT.Text = this.dataGridReservation.CurrentRow.Cells[1].Value.ToString(); DATE_RESERVATION.Text = this.dataGridReservation.CurrentRow.Cells[2].Value.ToString(); MODEL_NAME.Text = this.dataGridReservation.CurrentRow.Cells[3].Value.ToString(); RENTAL_DAYS.Text = this.dataGridReservation.CurrentRow.Cells[4].Value.ToString(); dataGridReservation.Rows.RemoveAt(dataGridReservation.CurrentRow.Index); AMOUNT.Focus(); } catch { return; } }