Exemplo n.º 1
0
 private void AmountTextBox_TextChanged(object sender, EventArgs e)
 {
     if (AmountTextBox.ValidateEmpty())
     {
         AmountTextBox.BackColor = System.Drawing.Color.White;
     }
 }
Exemplo 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);
            }
        }
Exemplo n.º 3
0
 private void AmountTextBox_TextChanged_1(object sender, EventArgs e)
 {
     if (AmountTextBox.ValidateEmpty())
     {
         AmountTextBox.BackColor = Color.White;
     }
     if (!double.TryParse(AmountTextBox.Text, out double result))
     {
         MessageBox.Show("Only numeric number is supported ");
         AmountTextBox.BackColor = Color.OrangeRed;
     }
 }