コード例 #1
0
 private bool IsFormValid()
 {
     if (NameTextBox.Text.Trim() == string.Empty)
     {
         Messages.ShowErrorMessage("Name is required");
         NameTextBox.Clear();
         NameTextBox.Focus();
         return(false);
     }
     if (EmailTextBox.Text.Trim() == string.Empty)
     {
         Messages.ShowErrorMessage("Email is required");
         EmailTextBox.Clear();
         EmailTextBox.Focus();
         return(false);
     }
     if (TelephoneTextBox.Text.Trim() == string.Empty)
     {
         Messages.ShowErrorMessage("Telephone is required");
         TelephoneTextBox.Clear();
         TelephoneTextBox.Focus();
         return(false);
     }
     return(true);
 }
コード例 #2
0
ファイル: Doubles.cs プロジェクト: DLosmi145/radpop
        private void SaveButton_Click(object sender, EventArgs e)
        {
            SqlCeConnection Connection = DataBaseConnection.Instance.Connection;

            try
            {
                if (NameTextBox.Text == "")
                {
                    MessageBox.Show("Unesite ime para!");
                }
                else if (SportComboBox.Text == "")
                {
                    MessageBox.Show("Uzaberite vrstu sporta!");
                }



                else
                {
                    SqlCeCommand command = new SqlCeCommand("INSERT INTO Doubles (Name, Sports_Id) VALUES" + " ('" + NameTextBox.Text + "', '" + SportComboBox.Text + "'); ", Connection);

                    command.ExecuteNonQuery();

                    MessageBox.Show("Unos je uspio!");
                    NameTextBox.Clear();
                    NameTextBox.Focus();
                }
            }

            catch (Exception ee)
            {
                MessageBox.Show("Unos nije uspio! \r Greska: " + ee.Message);
                return;
            }
        }
コード例 #3
0
 private void ClearTextFields()
 {
     NameTextBox.Clear();
     MailTextBox.Clear();
     MailUserLabel.Content  = $"Mail: ";
     MailAdminLabel.Content = $"Mail: ";
 }
コード例 #4
0
 private void refresh()
 {
     NameTextBox.Clear();
     idTextBox.Clear();
     DscribeTextBox.Clear();
     bindingDateGridView(null);
 }
コード例 #5
0
 private void OnUpdateUserListClicked(object sender, RoutedEventArgs e) //user values updated
 {
     if (usrListselected)                                               //if an item from user list is selected
     {
         currentItem = (Users)UserListListBox.SelectedItem;
         userList.Remove(currentItem);
         currentItem.Name   = NameTextBox.Text;
         currentItem.E_Mail = E_MailTextBox.Text;
         userList.Add(currentItem);
         UserListListBox.ItemsSource = userList;
         UserListListBox.Items.Refresh();
         RemoveEmptyEntries();
         NameTextBox.Clear();
         E_MailTextBox.Clear();
     }
     else if (adminListSelected)//if an item from admin list is selected
     {
         currentItem = (Users)AdminListListBox.SelectedItem;
         adminList.Remove(currentItem);
         currentItem.Name   = NameTextBox.Text;
         currentItem.E_Mail = E_MailTextBox.Text;
         adminList.Add(currentItem);
         AdminListListBox.ItemsSource = adminList;
         AdminListListBox.Items.Refresh();
         RemoveEmptyEntries();
         NameTextBox.Clear();
         E_MailTextBox.Clear();
     }
     if (NameTextBox.Text.Length == 0 || E_MailTextBox.Text.Length == 0)
     {
         UpdateUserListButton.IsEnabled = false;
         AddToUserListButton.IsEnabled  = false;
     }
 }
コード例 #6
0
ファイル: Form1.cs プロジェクト: Essisten/Sheet
        private void EditProductButton_Clickk(object sender, EventArgs e)
        {
            if (edit == -1)
            {
                AddProductButton.Hide();
                DeleteProductButton.Hide();
            }
            else
            {
                AddProductButton.Show();
                DeleteProductButton.Show();
            }

            if (edit == 1)
            {
                try
                {
                    Products[ProductsGridView.CurrentCell.RowIndex].Size  = ToInt64(SizeTextBox.Text);
                    Products[ProductsGridView.CurrentCell.RowIndex].Name  = NameTextBox.Text;
                    Products[ProductsGridView.CurrentCell.RowIndex].Price = ToDouble(PriceTextBox.Text);
                    Products[ProductsGridView.CurrentCell.RowIndex].Date  = Convert.ToString(DateTimePickerOfProduct.Value);
                    ProductsGridView.CurrentRow.SetValues(Products[ProductsGridView.CurrentCell.RowIndex].Id, Products[ProductsGridView.CurrentCell.RowIndex].Size, Products[ProductsGridView.CurrentCell.RowIndex].Date, Products[ProductsGridView.CurrentCell.RowIndex].Name, Products[ProductsGridView.CurrentCell.RowIndex].Price);
                    SizeTextBox.Clear();
                    NameTextBox.Clear();
                    PriceTextBox.Clear();
                }
                catch (Exception)
                {
                    MessageBox.Show("Ошибка");
                }
            }
            edit *= -1;
        }
コード例 #7
0
ファイル: MainForm.cs プロジェクト: fo-xi/ContactsApp
        /// <summary>
        /// Deletes contact information in the list and ListBox.
        /// </summary>
        private void RemoveContact()
        {
            var selectedIndex = AllContactsListBox.SelectedIndex;

            if (selectedIndex == -1)
            {
                MessageBox.Show("Select a contact from the list", "Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
                //TODO: если после if-else нет никакой общей логики, тогда в if можно написать return, а else с лишней вложенностью убрать (+)
            }

            DialogResult result = MessageBox.Show("Do you really want to remove this contact?",
                                                  "Remove contact", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (result == DialogResult.OK)
            {
                var selectedContact = _contacts[selectedIndex];
                _project.Contacts.Remove(selectedContact);
                AllContactsListBox.Items.RemoveAt(selectedIndex);
                SurnameTextBox.Clear();
                NameTextBox.Clear();
                PhoneTextBox.Clear();
                EmailTextBox.Clear();
                VkIDTextBox.Clear();
                SaveToFile();
            }
            SortingFoundContacts();
        }
コード例 #8
0
        private async void CreateFoodButton_Click(object sender, EventArgs e)
        {
            if (_isHubConnectionStarted is false)
            {
                await _hubConnection.StartAsync();

                _isHubConnectionStarted = true;
            }

            CreateFoodDto createFoodDto = new CreateFoodDto
            {
                Name        = NameTextBox.Text,
                Description = DescriptionTextBox.Text,
                Ingredients = IngredientsTextBox.Text,
            };

            await _hubConnection.SendAsync("CreateFood", createFoodDto);

            _hubConnection.On <bool>("CreateFoodResult", handler =>
            {
                if (handler)
                {
                    MessageBox.Show("Created.");

                    NameTextBox.Clear();
                    DescriptionTextBox.Clear();
                    IngredientsTextBox.Clear();
                }
                else
                {
                    MessageBox.Show("Faild to create.");
                }
            });
        }
コード例 #9
0
 private void RegisterButton_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(PhoneTextBox.Text) && !string.IsNullOrEmpty(NameTextBox.Text) && !string.IsNullOrEmpty(PasswordBox.Password) && !string.IsNullOrEmpty(ConfirmPasswordBox.Password))
     {
         if (PasswordBox.Password == ConfirmPasswordBox.Password)
         {
             if (!service.SignUpEmployee(NameTextBox.Text, PhoneTextBox.Text, PasswordBox.Password, "default", out string message, out Employee user))
             {
                 Close();
             }
             else
             {
                 PhoneTextBox.Clear();
                 NameTextBox.Clear();
                 PasswordBox.Clear();
                 ConfirmPasswordBox.Clear();
             }
         }
         else
         {
             MessageBox.Show("Passwords in to fields should be equal");
             PasswordBox.Clear();
             ConfirmPasswordBox.Clear();
             PasswordBox.Focus();
         }
     }
コード例 #10
0
ファイル: Form1.cs プロジェクト: vsingh-007/Repos
 void ClearTextBox()
 {
     NameTextBox.Clear();
     GenderTextBox.Clear();
     AgeTextBox.Clear();
     DepartmentTextBox.Clear();
 }
コード例 #11
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (NameTextBox.Text == "")
            {
                MessageBox.Show("Employee name not entered.");
                NameTextBox.Focus();
                return;
            }

            int IDNumber;

            try {
                IDNumber = int.Parse(IDTextBox.Text);
            } catch {
                MessageBox.Show("Invalid Employee ID.");
                IDTextBox.Focus();
                return;
            }

            myEmployee.NewEmployee(NameTextBox.Text, IDNumber, DepartmentTextBox.Text, PositionTextBox.Text);

            NameTextBox.Clear();
            IDTextBox.Clear();
            DepartmentTextBox.Clear();
            PositionTextBox.Clear();

            ListBox.Items.Add("Employee: " + IDNumber + " added!");

            NameTextBox.Focus();
        }
コード例 #12
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // clear form and re-create all obj
            newTest = true;

            NameTextBox.Clear();
            AgeNumericUpDown1.Value = 0;
            MaxHRTextBox.Clear();
            HR85textBox.Clear();
            MaleRadioButton.Checked          = false;
            FemaleRadioButton.Checked        = false;
            readynessCheckBox.Checked        = false;
            contraIndicationCheckBox.Checked = false;
            lifestyleCheckBox.Checked        = false;
            aerobicTextBox.Clear();
            fitnessTextBox.Clear();
            RemarksRichTextBox.Clear();
            HR1NumericUpDown.Value = 0;
            HR2NumericUpDown.Value = 0;
            HR3NumericUpDown.Value = 0;
            HR4NumericUpDown.Value = 0;
            HR5NumericUpDown.Value = 0;

            foreach (var series in chart1.Series)
            {
                series.Points.Clear();
            }
            checkAllForm();

            currentTested = new Tested();
        }
コード例 #13
0
 private void CancelButton_Click(object sender, EventArgs e)
 {
     CancelButton.Visible = false;
     NameTextBox.Clear();
     selectedCompanyId   = -1;
     selectedCompanyName = null;
     SaveButton.Text     = "Save";
 }
コード例 #14
0
 private void SaveContent_Click(object sender, RoutedEventArgs e)
 {
     SetInnitialWalletValue(PlayerName);
     CreditLabel.Content = person.wallet.GetCredit();
     CreditTextBox.Clear();
     NameLabel.Content = PlayerName + "'s Game";
     NameTextBox.Clear();
 }
コード例 #15
0
 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.
 }
コード例 #16
0
 private void ClearForm()
 {
     // option A
     NameTextBox.Clear();
     AgeTextBox.Clear();
     SubmitButton.Enabled = false;
     // option B - NameTextBox.Text = string.Empty; // or ""
 }
コード例 #17
0
ファイル: Form1.cs プロジェクト: smolyankin/FastOrder
 public void TbClear()
 {
     ShTextBox.Clear();
     ArtTextBox.Clear();
     NameTextBox.Clear();
     CountTextBox.Clear();
     comboBox1.SelectedIndex = -1;
 }
コード例 #18
0
 private void ClearForm()
 {
     NameTextBox.Clear();
     AgeTextBox.Clear();
     //other way:
     //NameTextBox.Text = string.Empty;
     SubmitButton.Enabled = false;
 }
コード例 #19
0
 void ClearMethod()
 {
     NameTextBox.Clear();
     AgeTextBox.Clear();
     AddressTextBox.Clear();
     PhoneTextBox.Clear();
     HistoryTextBox.Clear();
 }
コード例 #20
0
ファイル: MainForm.cs プロジェクト: Vanada1/ContactsApp
 /// <summary>
 /// Clears all Text boxes
 /// </summary>
 private void ClearTextBoxes()
 {
     SurnameTextBox.Clear();
     NameTextBox.Clear();
     BirthdayDateTimePicker.Value = BirthdayDateTimePicker.MinDate;
     PhoneMaskedTextBox.Clear();
     EmailTextBox.Clear();
     VkTextBox.Clear();
 }
コード例 #21
0
        private void ClearInputs()
        {
            MarkAllValid();

            DebugIDLabel.ClearValue(Label.ContentProperty);
            NameTextBox.Clear();
            FlagTextBox.Clear();
            ContinentComboBox.ClearValue(ComboBox.SelectedValueProperty);
        }
コード例 #22
0
 //This method clears all textboxes and reset drop downs to default values
 private void ClearAllFields()
 {
     NameTextBox.Clear();
     AgeComboBox.SelectedItem    = 18;
     GenderComboBox.SelectedItem = "Select";
     EmailTextBox.Clear();
     CustomerStatusComboBox.SelectedItem       = "Select";
     CommunicationChannelComboBox.SelectedItem = "Select";
 }
コード例 #23
0
 private void ClearForm()
 {
     NameTextBox.Clear();
     EmailTextBox.Clear();
     PhoneTextBox.Clear();
     AddressTextBox.Clear();
     Products.Clear();
     TotalTextBox.Text = "0";
 }
コード例 #24
0
 private void reset()
 {
     bindingDateGridView();
     idTextBox.Clear();
     NameTextBox.Clear();
     PriceTextBox.Clear();
     comboBoxOrderStatus.SelectedIndex = 0;
     comboBoxType.SelectedIndex        = 0;
 }
コード例 #25
0
ファイル: Form1.cs プロジェクト: mattdurham/LookupTable
        private void resetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //When user wants to reset form, they will click on Reset

            NameTextBox.Clear();
            FeelTextBox.Clear();
            YearTextBox.Clear();
            ProfileTextBox.Clear();
        }
コード例 #26
0
        //更新反序列信息
        public void ShowAllBook()
        {
            Thread thread = new Thread(threadStart);

            thread.Start();
            IDTextBox.Clear();
            NameTextBox.Clear();
            thread.Abort();
        }
コード例 #27
0
 private void ClearAllInputs()
 {
     userNameTextBox.Clear();
     passwordTextBox.Clear();
     NameTextBox.Clear();
     SurnameTextBox.Clear();
     registerUserNameTextBox.Clear();
     registerPasswordTextBox.Clear();
     confirmTextBox.Clear();
 }
コード例 #28
0
        public void Clear()
        {
            if (!(DataContext is EnterDataViewModel enterDataViewModel))
            {
                return;
            }

            enterDataViewModel.Name = string.Empty;
            NameTextBox.Clear();
        }
コード例 #29
0
 private void ClearText()
 {
     NameTextBox.Clear();
     AddressTextBox.Clear();
     PostalCodeTextBox.Clear();
     CityTextBox.Clear();
     TelephoneTextBox.Clear();
     EmailTextBox.Clear();
     ContactTypeComboBox.SelectedIndex = -1;
 }
コード例 #30
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (NameTextBox.Text.Length < 1)
            {
                return;
            }

            AdminUsersManagement.Add(NameTextBox.Text);
            NameTextBox.Clear();
        }