private void cboRes_ID_SelectedIndexChanged(object sender, EventArgs e) { // stops system from crashing when updating combo box if (cboRes_ID.SelectedIndex == -1) { return; } Reservations myRes = new Reservations(); myRes.getReservation(Convert.ToInt32(cboRes_ID.Text.Substring(0, 6))); //load form controls with data from myRes txtName.Text = myRes.getCust_Name(); txtDateDep.Text = myRes.getDate_Depart().ToString().Substring(0, 10); txtDateArr.Text = myRes.getDate_Arrive().ToString().Substring(0, 10); txtResId.Text = myRes.getRes_ID().ToString("000000"); //display reservation details grpDeleteRes.Visible = true; }
private void cboRes_ID_SelectedIndexChanged(object sender, EventArgs e) { if (cboRes_ID.SelectedIndex == -1) { return; } //retrieve reservation and display on UI Reservations myRes = new Reservations(); myRes.getReservation(Convert.ToInt32(cboRes_ID.Text.Substring(0, 6))); //load form controls with data from myRes txtName.Text = myRes.getCust_Name(); //formating date arrive text so that the secounds are cut from the date txtDateArr.Text = myRes.getDate_Arrive().ToString().Substring(0, 10); //returning resid in the format 000001 etc txtResID.Text = myRes.getRes_ID().ToString("000000"); //display reservation details grpCheckOut.Visible = true; }