private void LeaveForm(object sender, EventArgs e) => Close(); //close the form //---------------------------------------------------------------------------------------------------------------------------------------- private void AccountTypeSwitch(object sender, EventArgs e) { var temp = (ComboBox)sender; //capture the control that trigger this event //determine the account type and show the correspond textbox will show //to the user if (temp.SelectedItem.ToString() == "Teacher") { AccountNoValue.Text = "(Teacher No.)"; AccCredentialPanel.Visible = true; } if (temp.SelectedItem.ToString() == "Student") { AccountNoValue.Text = "(Student NO.)"; AccCredentialPanel.Visible = false; } //---------------------------------------------------------------------------------------------------------------------------------- //enabled some common textbox to the account List <Control> controls = new List <Control>(new TextBox[] { fnameValue, mnameValue, lnameValue, contactValue, emailValue, addressValue, bdateValue }); EnableControl.ControlEnable(controls, true); }
//------------------------------------------------------------------------------------------------------- //open the searching form private void SearchAndFind(object sender, EventArgs e) { ChangeColor.BackColor(SearchPeoplePanel, System.Drawing.Color.WhiteSmoke); Search.FormClosed += (x, y) => EnableControl.ControlEnable(this, true); //enabled the dashboard form when this form closed EnableControl.ControlEnable(this, false); //unable the dashboard when using this form Search.Show(); }