Esempio n. 1
0
 private void CurrencyComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (CurrencyComboBox.ValidateEmpty())
     {
         CurrencyComboBox.BackColor = System.Drawing.Color.White;
     }
 }
Esempio n. 2
0
        private bool ValidateUserInputs()
        {
            int failedCount = 0;

            if (!NameTextBox.ValidateEmpty())
            {
                NameTextBox.BackColor = Color.OrangeRed;
                failedCount++;
            }
            if (!NameTextBox.ValidateUniqeName())
            {
                MessageBox.Show("Fail to add as the name alread exists");
                NameTextBox.BackColor = Color.OrangeRed;
                failedCount++;
            }

            if (!AmountTextBox.ValidateEmpty())
            {
                AmountTextBox.BackColor = Color.OrangeRed;
                failedCount++;
            }

            if (!AmountTextBox.ValidatePositiveNumber())
            {
                MessageBox.Show("The amount should be positive");
                AmountTextBox.BackColor = Color.OrangeRed;
                failedCount++;
            }

            if (!CategoryComboBox.ValidateEmpty())
            {
                CategoryComboBox.BackColor = Color.OrangeRed;
                failedCount++;
            }
            if (!CurrencyComboBox.ValidateEmpty())
            {
                CurrencyComboBox.BackColor = Color.OrangeRed;
                failedCount++;
            }
            if (!OccuredTimePicker.ValidateEmpty())
            {
                OccuredTimePicker.BackColor = Color.OrangeRed;
                OccuredTimePicker.Focus();
                failedCount++;
            }
            if (failedCount > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }