Пример #1
0
 private void godate_Click(object sender, EventArgs e)
 {
     MessageBox.Show(this.end.Text);
     Date datepage = new Date();
     datepage.sDate.Text = this.start.Text;
     datepage.eDate.Text = this.end.Text;
     this.Close();
     datepage.Show();
 }
        private void godate_Click(object sender, EventArgs e)
        {
            DateTime sampledate;
            bool error = false;
            if (DateTime.TryParse(start.Text, out sampledate))
            {
                start.BackColor = Color.White;
            }
            else
            {
                error = true;
                start.BackColor = Color.Red;
            }

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

            if (error == false)
            {
                Date datepage = new Date();
                datepage.sDate.Text = this.start.Text;
                datepage.eDate.Text = this.end.Text;
                if (!datepage.IsDisposed)
                {
                    this.Dispose();
                    datepage.Show();
                }
            }
            else
            {
                error = false;
            }
        }