private void resetFormToolStripMenuItem_Click(object sender, EventArgs e) { NameTextbox.Clear(); EmailTextBox.Clear(); MobileTextBox.Clear(); AddressTextBox.Clear(); }
void ClearMethod() { NameTextBox.Clear(); AgeTextBox.Clear(); AddressTextBox.Clear(); PhoneTextBox.Clear(); HistoryTextBox.Clear(); }
private void FindButton_Click(object sender, RoutedEventArgs e) //Finds the competitor in the SkiRun class. { NameTextBox.Clear(); //Clears the name text box. AddressTextBox.Clear(); //Clears the address text box. ScoreTextBox.Clear(); //Clears the score text box. TagTextBox.Clear(); //Clears the tag text box. FindCompetitor(); //Calls the FindCompetitor method above. }
private void ClearForm() { NameTextBox.Clear(); EmailTextBox.Clear(); PhoneTextBox.Clear(); AddressTextBox.Clear(); Products.Clear(); TotalTextBox.Text = "0"; }
private void ClearText() { NameTextBox.Clear(); AddressTextBox.Clear(); PostalCodeTextBox.Clear(); CityTextBox.Clear(); TelephoneTextBox.Clear(); EmailTextBox.Clear(); ContactTypeComboBox.SelectedIndex = -1; }
private void SaveButton_Click(object sender, EventArgs e) { SqlCeConnection Connection = DataBaseConnection.Instance.Connection; try { if (First_nameTextBox.Text == "") { MessageBox.Show("Unesite ime!"); } else if (Last_nameTextBox.Text == "") { MessageBox.Show("Unesite prezime!"); } else if (Access_levelTextBox.Text == "") { MessageBox.Show("Unesite nivo pristupa!"); } else { bool isUnique = UserRepository.CheckUnique(First_nameTextBox.Text); if (isUnique != true) { UserRepository.InsertUser(First_nameTextBox.Text, First_nameTextBox.Text + Last_nameTextBox.Text); int WorkpeopleId = UserRepository.GetIdByName(First_nameTextBox.Text); SqlCeCommand command = new SqlCeCommand("INSERT INTO Workpeople (First_name, Last_name, Phone_number, Address, Access_level, User_Id) VALUES" + " ('" + First_nameTextBox.Text + "', '" + Last_nameTextBox.Text + "', '" + Phone_numberTextBox.Text + "', '" + AddressTextBox.Text + "', '" + Access_levelTextBox.Text + "', '" + WorkpeopleId + "'); ", Connection); command.ExecuteNonQuery(); MessageBox.Show("Unos je uspio!"); First_nameTextBox.Clear(); Last_nameTextBox.Clear(); Phone_numberTextBox.Clear(); AddressTextBox.Clear(); Access_levelTextBox.Clear(); First_nameTextBox.Focus(); } } } catch (Exception ee) { MessageBox.Show("Unos nije uspio! \r Greska: " + ee.Message); return; } }
private void AddCustomersButton_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(); //символен низ за връзка към базата данни – взема се от файл с име app.config con.ConnectionString = ConfigurationManager.ConnectionStrings["MassiveDynamic.Properties.Settings.MassiveDynamicConnectionString"].ConnectionString; //символен низ със заявката към базата данни string insertIntoId = "'" + CustomerIdAddTextBox.Text + "'"; string inserIntoCustomerName = "'" + CompanyNameTextBox.Text + "'"; string inserIntoCustomerAddress = "'" + AddressTextBox.Text + "'"; string inserIntoCustomerPhone = "'" + CustomerPhoneTextBox.Text + "'"; //INSERT INTO table_name (column1,column2,column3,...) VALUES(value1, value2, value3,...); Insert into cheatSheet string insertCommand = string.Format("insert into Customers (CustomerID,CompanyName,Address,Phone) values({0},{1},{2},{3});", insertIntoId, inserIntoCustomerName, inserIntoCustomerAddress, inserIntoCustomerPhone); SqlCommand com = new SqlCommand(insertCommand, con); //определяне на типа на командата - в конкретния случай е текст com.CommandType = CommandType.Text; try { //отваряме връзката към базата данни con.Open(); //изпълняваме командата / в този случай нямаме връщан резултат com.ExecuteNonQuery(); //извеждаме съобщение, че всичко е преминало успешно MessageBox.Show("Данните за форма на обучение са добавени успешно!", "Message/Съобщение"); //изчистваме въведената стойност в текстовото поле CustomerIdAddTextBox.Clear(); CompanyNameTextBox.Clear(); AddressTextBox.Clear(); CustomerPhoneTextBox.Clear(); } //ако не е преминало всичко успешно, това означава, че е възникнало изключение catch (Exception exe) { //извеждаме съобщение с възникналото изключение MessageBox.Show(exe.ToString(), "Message/Съобщение:"); } //затваря се връзката към базата данни con.Close(); //затваря се отворената форма this.Close(); }
private void StoreBtn_Click(object sender, EventArgs e) { //verifies data was entered if (string.IsNullOrEmpty(FirstNameTextbox.Text)) { MessageBox.Show("Please enter your First Name."); return; } if (string.IsNullOrEmpty(LastNameTextbox.Text)) { MessageBox.Show("Please enter your Last Name."); return; } if (string.IsNullOrEmpty(AddressTextBox.Text)) { MessageBox.Show("Please enter your Address."); return; } if (string.IsNullOrEmpty(AddressTextBox.Text)) { MessageBox.Show("Please enter your City/State/Zipcode."); return; } if (string.IsNullOrEmpty(PhoneNumberTextbox.Text)) { MessageBox.Show("Please enter your Phone Number"); return; } //calls method to add data addData(FirstNameTextbox.Text, LastNameTextbox.Text, AddressTextBox.Text, CityStateZipcodeTextboc.Text, PhoneNumberTextbox.Text); //clears all items FirstNameTextbox.Clear(); LastNameTextbox.Clear(); AddressTextBox.Clear(); CityStateZipcodeTextboc.Clear(); PhoneNumberTextbox.Clear(); }
private void ClearData_Click(object sender, RoutedEventArgs e) { activeSkiRun.ClearCompData(); //Calls a method in the SkiRun class which empties the dictionary and the lists. IncomeTextBox.Clear(); //Clears the income textbox. TotalScoresTextBox.Clear(); //Clears the total scores text box. EntriesTextBox.Clear(); //Clears the ammount of entries the competiton had. TopThreeScoresTextBox.Clear(); //Clears the high scores text box so data doesn't overlap. AgeMinTextBox.Clear(); //Clears the minimum age textbox. AgeMaxTextBox.Clear(); //Clears the maximum age textbox. AgeAveTextBox.Clear(); //Clears the average age textbox. AgeModeTextBox.Clear(); //Clears the mode age textbox. activeSkiRun.CompetitorAges.Clear(); //Clears the ages list. CompetitorNumberTextBox.Text = "000000"; //Resets the competitor number text box. NumberTextBox.Clear(); //Clears the number text box. NameTextBox.Clear(); //Clears the name text box. AddressTextBox.Clear(); //Clears the address text box. DetailsTextBox.Clear(); //Clears the details text box. ScoreTextBox.Clear(); //Clears the scores text box. SearchTextBox.Clear(); //Clears the seach by name text box. TagTextBox.Clear(); //Clears the tag text box. SearchByName.Items.Clear(); //Clears the search by name combo box. }
private void SaveButton_Click(object sender, EventArgs e) { SqlCeConnection Connection = DataBaseConnection.Instance.Connection; try { if (NameTextBox.Text == "") { MessageBox.Show("Unesite naziv grada!"); } else if (AddressTextBox.Text == "") { MessageBox.Show("Unesite adresu!"); } else { SqlCeCommand command = new SqlCeCommand("INSERT INTO Code_betting_shop (Name, Address) VALUES" + " ('" + NameTextBox.Text + "', '" + AddressTextBox.Text + "'); ", Connection); command.ExecuteNonQuery(); MessageBox.Show("Unos je uspio!"); NameTextBox.Clear(); AddressTextBox.Clear(); NameTextBox.Focus(); } } catch (Exception ee) { MessageBox.Show("Unos nije uspio! \r Greska: " + ee.Message); return; } }
private bool IsFormValidate() { if (FullNameTextBox.Text.Trim() == "") { MessageBox.Show("Full Name is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); FullNameTextBox.Clear(); FullNameTextBox.Focus(); return(false); } if (FatherNameTextBox.Text.Trim() == "") { MessageBox.Show("Father Name is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); FatherNameTextBox.Clear(); FatherNameTextBox.Focus(); return(false); } if (MotherNameTextBox.Text.Trim() == "") { MessageBox.Show("Mother Name is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); MotherNameTextBox.Clear(); MotherNameTextBox.Focus(); return(false); } if (AddressTextBox.Text.Trim() == "") { MessageBox.Show("Address is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); AddressTextBox.Clear(); AddressTextBox.Focus(); return(false); } if (EmailTextBox.Text.Trim() == "") { MessageBox.Show("Email Name is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); EmailTextBox.Clear(); EmailTextBox.Focus(); return(false); } if (MobileTextBox.Text.Trim() == "") { MessageBox.Show("Mobile number is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); MobileTextBox.Clear(); MobileTextBox.Focus(); return(false); } if (BloodGroupTextBox.Text.Trim() == "") { MessageBox.Show("Blood Group is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); BloodGroupTextBox.Clear(); BloodGroupTextBox.Focus(); return(false); } if (GenderComboBox.SelectedIndex == -1) { MessageBox.Show("Gender is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } if (BranchComboBox.SelectedIndex == -1) { MessageBox.Show("Branch is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } return(true); }
private void AddCustomerInfo() { try { if (customerNameTextBox.Text == "" || ContactNoTextBox.Text == "" || AddressTextBox.Text == "" || orderComboBox.Text == "" || quantityTextBox.Text == "" || orderComboBox.Text == "Select") { if (customerNameTextBox.Text == "") { customerNameTextBox.Text = string.Empty; MessageBox.Show("Customer Name Required"); } else if (ContactNoTextBox.Text == "") { ContactNoTextBox.Text = string.Empty; MessageBox.Show("Contact No Required"); } else if (AddressTextBox.Text == "") { AddressTextBox.Text = string.Empty; MessageBox.Show("Address Required"); } else if (orderComboBox.Text == "" || orderComboBox.Text == "Select") { orderComboBox.Text = string.Empty; MessageBox.Show("Select Your order Item"); } else if (quantityTextBox.Text == "") { quantityTextBox.Text = string.Empty; MessageBox.Show("Quantity Required"); } else { return; } } else { Names.Add(customerNameTextBox.Text); customerNameTextBox.Clear(); if (Contacts.Contains(ContactNoTextBox.Text) == true) { MessageBox.Show("This 'Contact No' have already used!"); return; } else { Contacts.Add(ContactNoTextBox.Text); ContactNoTextBox.Clear(); } Addresses.Add(AddressTextBox.Text); AddressTextBox.Clear(); Orders.Add(orderComboBox.Text); orderComboBox.Text = string.Empty; Quantities.Add(Convert.ToInt32(quantityTextBox.Text)); quantityTextBox.Clear(); identify++; ShowSingleCustomerInfo(); } } catch (Exception ex) { MessageBox.Show("Wrong Input"); return; } }
private void FindCompetitor() //Set up to find the competitors by their number. { DetailsTextBox.Clear(); //Clears the details textbox. Competitor editSkier; //Makes aninstance of the Competitor class. if (SearchTextBox.Text.Trim() != "" && NumberTextBox.Text.Trim() != "") //You can only use on search method so if there is text in both it will be rejected. { MessageBox.Show("Please use only one search method!"); //The error message. } else if (SearchByName.Text.Trim() == "" && NumberTextBox.Text.Trim() == "") //If there is no text in either search methods then the search will fail. { editSkier = null; //There's no competitor. MessageBox.Show("There is no competitor with that number or name! Please try again."); //The error message. NameTextBox.Clear(); //Clears the name text box. AddressTextBox.Clear(); //Clears the address text box. ScoreTextBox.Clear(); //Clears the score text box. NumberTextBox.Clear(); //Clears number text box. TagTextBox.Clear(); //Clears the tag text box. } //***NOTE*** - This is a very inefficient way to seach. I have the same code twice for each search method because I didn't know how to differentiate between the two. else if (SearchByName.Text.Trim() != "") //If search by name has some text in it then it will make a competitor. { editSkier = SkiRun.FindSkierByName(SearchByName.Text.Trim()); //Calls the find competitor by name in the SkiRun class. try { NameTextBox.Text = editSkier.GetName().Trim(); //Sets the competitor name. AddressTextBox.Text = editSkier.GetAddress().Trim(); //Sets the competitor address. ScoreTextBox.Text = editSkier.GetScore().Trim(); //Sets the competitor score. if (editSkier.GetSponsor() == null && editSkier.GetBlood() == null && editSkier.GetNoK() == null) //If there's no sponsor, no blood type and no next of kin then it must be an amateur. { DetailsTextBox.Text = "Class: Amatuer" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £100"; //Information show in details text box. TagTextBox.Text = "Amateur"; //Displays the tag in the tag text box. } else if (editSkier.GetSponsor() != null) //If the sponsor does no equal null then it must be a professional. { DetailsTextBox.Text = "Class: Professional" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £200" + Environment.NewLine + "Sponsor: " + editSkier.GetSponsor(); //Information show in details text box. TagTextBox.Text = "Professional"; //Displays the tag in the tag text box. } else if (editSkier.GetBlood() != null) //If blood type does not equal null then is must be a celebrity. { DetailsTextBox.Text = "Class: Celebrity" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You do not have to pay." + Environment.NewLine + "Blood Type: " + editSkier.GetBlood() + Environment.NewLine + "Next of Kin: " + editSkier.GetNoK(); //Information show in details text box. TagTextBox.Text = "Celebrity"; //Displays the tag in the tag text box. } } catch { MessageBox.Show("Could not find competitor!"); //If the user types a name it cannot find then it will display this. } } else if (NumberTextBox.Text.Trim() != "") //If the number text box has something in it then it will use this method. { editSkier = SkiRun.FindSkier(NumberTextBox.Text.Trim()); //Calls the find competitor in the SkiRun class. try { NameTextBox.Text = editSkier.GetName(); //Sets the competitor name. AddressTextBox.Text = editSkier.GetAddress(); //Sets the competitor address. ScoreTextBox.Text = editSkier.GetScore(); //Sets the competitor score. if (editSkier.GetSponsor() == null && editSkier.GetBlood() == null && editSkier.GetNoK() == null) //If there's no sponsor, no blood type and no next of kin then it must be an amateur. { DetailsTextBox.Text = "Class: Amatuer" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £100"; //Information show in details text box. TagTextBox.Text = "Amateur"; //Displays the tag in the tag text box. } else if (editSkier.GetSponsor() != null) //If the sponsor does no equal null then it must be a professional. { DetailsTextBox.Text = "Class: Professional" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £200" + Environment.NewLine + "Sponsor: " + editSkier.GetSponsor(); //Information show in details text box. TagTextBox.Text = "Professional"; //Displays the tag in the tag text box. } else if (editSkier.GetBlood() != null) //If blood type does not equal null then is must be a celebrity. { DetailsTextBox.Text = "Class: Celebrity" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You do not have to pay." + Environment.NewLine + "Blood Type: " + editSkier.GetBlood() + Environment.NewLine + "Next of Kin: " + editSkier.GetNoK(); //Information show in details text box. TagTextBox.Text = "Celebrity"; //Displays the tag in the tag text box. } } catch { MessageBox.Show("Could not find competitor!"); //If the user types a name it cannot find then it will display this. } } //NumberTextBox.Clear(); //SearchByName.Items.Clear(); //SearchTextBox.Clear(); }