/// <summary>Clears all TextBoxes.</summary> private void Clear() { TxtID.Clear(); TxtFirstName.Clear(); TxtLastName.Clear(); TxtID.Focus(); }
private void BtnClear_Click(object sender, RoutedEventArgs e) { TxtFirstName.Clear(); TxtLastName.Clear(); TxtMiddleName.Clear(); CmbGender.SelectedItem = null; CmbPlayer.SelectedItem = null; }
private void BtnClear_Click(object sender, EventArgs e) { TxtFirstName.Clear(); TxtLastName.Clear(); TxtGrade.Clear(); TxtAddress.Clear(); TxtContactNo.Clear(); }
private void BtnUpdate_Click(object sender, EventArgs e) { if (TxtFirstName.Text == "") { MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (TxtLastName.Text == "") { MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (TxtGrade.Text == "") { MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (TxtAddress.Text == "") { MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (TxtContactNo.Text == "") { MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { var result = MessageBox.Show("Confirm editing new record?", "Edit New Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { using (var con = new MySqlConnection(GetConnection())) { string command = $"UPDATE `lms.sad`.`tblusers`" + $" SET " + $"`First_Name`='{TxtFirstName.Text}',`Last_Name`='{TxtLastName.Text}',`Year_Level`='{TxtGrade.Text}',`Address`='{TxtAddress.Text}',`Contact_Number`='{TxtContactNo.Text}'" + $" WHERE `User_ID`='{TxtUserID.Text}'"; con.Open(); using (var cmd = new MySqlCommand(command, con)) { cmd.CommandType = CommandType.Text; var i = cmd.ExecuteNonQuery(); if (i > 0) { MessageBox.Show("Successfully Updated! Please refresh Book List to view entry!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtFirstName.Clear(); TxtLastName.Clear(); TxtGrade.Clear(); TxtAddress.Clear(); TxtContactNo.Clear(); TxtUserID.Clear(); } } con.Close(); } } } }
private void BtnClear_Click(object sender, RoutedEventArgs e) { TxtFirstName.Clear(); TxtLastName.Clear(); TxtMiddleName.Clear(); TxtEmail.Clear(); TxtPhone.Clear(); DpDateOfBirth.SelectedDate = null; CmbGender.SelectedItem = null; CmbNationality.SelectedItem = null; }
private void ClearData() { TxtName.Clear(); TxtLastName.Clear(); TxtPhone.Clear(); CbxTipoContacto.SelectedIndex = 0; _filename = ""; PbFotoPerfil.ImageLocation = ""; }
} // end method TxtID_Leave() /// <summary> /// To reset all controls on the add_emp form to their defaults /// </summary> private void ResetFields() { //Clear all txtboxes and reset radioBtns to HOURLY TxtID.Clear(); TxtFirstName.Clear(); TxtLastName.Clear(); TxtHourlyRate.Clear(); TxtMonthlySalary.Clear(); TxtCommissionRate.Clear(); TxtContractWage.Clear(); RBtnHourly.Checked = true; } // end method ResetFields()
private void BtnRegister_Click(object sender, EventArgs e) { if (TxtFirstName.Text == "") { MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (TxtLastName.Text == "") { MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (TxtGrade.Text == "") { MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (TxtAddress.Text == "") { MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (TxtContactNo.Text == "") { MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { var result = MessageBox.Show("Confirm adding new record?", "Add New Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { using (var con = new MySqlConnection(GetConnection())) { string command = $"INSERT INTO `lms.sad`.`tblusers` (`First_Name`,`Last_Name`, `Year_Level`, `Address`,`Contact_Number`) " + "VALUES " + $"('{TxtFirstName.Text}','{TxtLastName.Text}','{TxtGrade.Text}','{TxtAddress.Text}','{TxtContactNo.Text}')"; con.Open(); using (var cmd = new MySqlCommand(command, con)) { cmd.CommandType = CommandType.Text; var i = cmd.ExecuteNonQuery(); if (i > 0) { MessageBox.Show("Successfully Added! Please refresh Borrower List to view entry!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtFirstName.Clear(); TxtLastName.Clear(); TxtGrade.Clear(); TxtAddress.Clear(); TxtContactNo.Clear(); } } con.Close(); } } } }
/// <summary> /// actually clears each textbox in the form /// </summary> private void ClearNewEmpForm() { EpForm.Clear(); TxtID.Clear(); TxtFirstName.Clear(); TxtLastName.Clear(); TxtAddress.Clear(); TxtCity.Clear(); CBxState.SelectedIndex = -1; CBxEmpType.SelectedIndex = -1; TxtZip.Clear(); TxtHireDate.Clear(); CBxMarriageStatus.SelectedIndex = -1; TxtDept.Clear(); TxtJobTitle.Clear(); LblAfterSubmitMsg.Text = ""; TxtPayAmount.Visible = false; LblPayAmount.Visible = false; LblSecondInput.Visible = false; TxtSecondInput.Visible = false; }
/*************************************** * * This is where the UTILITY METHODS are. * ***************************************/ /// <summary> /// This clears the form after an entry is added. /// </summary> private void ClearForm() { TxtEmpID.Clear(); TxtFirstName.Clear(); TxtLastName.Clear(); TxtMiddleName.Clear(); TxtXtraProp1.Clear(); TxtXtraProp2.Clear(); CkbActiveEmployee.Checked = true; CkbBenefits.Checked = true; CkbApproved.Checked = true; LVxCourses.Items.Clear(); TxtCourseID.Clear(); TxtGrade.Clear(); TxtDescription.Clear(); TxtDateApproved.Clear(); TxtCredits.Clear(); TxtMaritalStatus.Clear(); TxtDepartment.Clear(); TxtTitle.Clear(); TxtStartDate.Clear(); }