Пример #1
0
 private void gocategory_Click(object sender, EventArgs e)
 {
     Category catpage = new Category();
     catpage.start = CStart.Text;
     catpage.end = CEnd.Text;
     catpage.id.Text = this.category.Text;
     this.Close();
     catpage.Show();
 }
        private void gocategory_Click(object sender, EventArgs e)
        {
            DateTime sampledate;
            bool error = false;
            if (DateTime.TryParse(CStart.Text, out sampledate))
            {
                CStart.BackColor = Color.White;
            }
            else
            {
                error = true;
                CStart.BackColor = Color.Red;
            }

            if (DateTime.TryParse(CEnd.Text, out sampledate))
            {
                CEnd.BackColor = Color.White;
            }
            else
            {
                error = true;
                CEnd.BackColor = Color.Red;
            }

            if (category.Text != "Choose")
            {
                category.BackColor = Color.White;
            }
            else
            {
                error = true;
                category.BackColor = Color.Red;
            }

            if (error == false)
            {
                Category catpage = new Category();
                catpage.start = CStart.Text;
                catpage.end = CEnd.Text;
                catpage.id.Text = this.category.Text;
                this.Dispose();
                catpage.Show();
            }
            else
            {
                error = false;
            }
        }