private void cboRes_ID_SelectedIndexChanged(object sender, EventArgs e) { //this stops stops system from crashing after updating. so that when the box clears to not execute the rest of the code 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(); //formating date arrive text so that the secounds are cut from the date txtDateDep.Text = myRes.getDate_Depart().ToString().Substring(0, 10); //returning resid in the format 000001 etc txtResId.Text = myRes.getRes_ID().ToString("000000"); //display reservation details grpCheckIn.Visible = true; }
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; }