Пример #1
0
        private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
        {
            Control Ctrl = (Control)sender;

            Ctrl.BackColor = Color.White;
            if (ReasonCB.Text == "Others")
            {
                ReasonCB.SelectedIndex = -1;
                ReasonCB.Focus();
            }
        }
Пример #2
0
        private Boolean Validation()
        {
            String Com, Dt;

            Com = MonthYear.Value.Date.ToString();
            Dt  = DateTime.Today.ToString();


            if (AmounttextBox.Text == "" || AmounttextBox.Text == "0")
            {
                AmounttextBox.BackColor = Color.DodgerBlue;
                MessageBox.Show("Amount Is Required", "Please Enter Amount", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                AmounttextBox.Focus();
                return(true);
            }
            if (ReasonCB.Text == "")
            {
                ReasonCB.BackColor = Color.DodgerBlue;
                MessageBox.Show("Reason Is Required", "Please Enter Reason", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                ReasonCB.Focus();
                return(true);
            }
            if (AttendanceAllowancetb.SelectedIndex == -1)
            {
                AttendanceAllowancetb.BackColor = Color.DodgerBlue;
                MessageBox.Show("Attendance Allowance Is Required", "Please Select Yes Or No", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                AttendanceAllowancetb.Focus();
                return(true);
            }

            if (Com == Dt)
            {
                DialogResult Result = MessageBox.Show("Do You Want To Enter To Day's Date ? ", "Yes Or No", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Result == DialogResult.No)
                {
                    MonthYear.Focus();
                    return(true);
                }
            }

            return(false);
        }