private void button1_Click(object sender, EventArgs e) { if (radioButton1.Checked) { DateTime Ngay; try { Ngay = Convert.ToDateTime(maskedTextBox1.Text); } catch { MessageBox.Show("ngay ko dung dinh dang"); return; } frmBaoCaorpt bc = new frmBaoCaorpt(Ngay); bc.Show(); this.Close(); } else if (radioButton2.Checked) { int Thang, Nam; try { Thang = Convert.ToInt32(comboBox1.Text); Nam = dateTimePicker1.Value.Year; } catch (Exception ex) { MessageBox.Show("Lam Gi Day"); Thang = 0; Nam = 0; } frmBaoCaorpt bc = new frmBaoCaorpt(Thang, Nam); bc.Show(); this.Close(); } else if (radioButton3.Checked) { DateTime Truoc, Sau; try { Truoc = Convert.ToDateTime(maskedTextBox2.Text); Sau = Convert.ToDateTime(maskedTextBox3.Text); } catch (Exception ex) { MessageBox.Show("Lam Gi Day"); Truoc = new DateTime(0, 0, 0); Sau = new DateTime(0, 0, 0); } frmBaoCaorpt bc = new frmBaoCaorpt(Truoc, Sau); bc.Show(); this.Close(); } }
private void button1_Click(object sender, EventArgs e) { if (radioButton1.Checked) { DateTime Ngay; try { Ngay = Convert.ToDateTime(maskedTextBox1.Text); } catch { MessageBox.Show("ngay ko dung dinh dang"); return; } frmBaoCaorpt bc = new frmBaoCaorpt(Ngay); bc.Show(); this.Close(); } else if (radioButton2.Checked) { int Thang, Nam; try { Thang = Convert.ToInt32(comboBox1.Text); Nam = dateTimePicker1.Value.Year; } catch (Exception ex) { MessageBox.Show("Lam Gi Day"); Thang = 0; Nam = 0; } frmBaoCaorpt bc = new frmBaoCaorpt(Thang,Nam); bc.Show(); this.Close(); } else if (radioButton3.Checked) { DateTime Truoc, Sau; try { Truoc = Convert.ToDateTime(maskedTextBox2.Text); Sau = Convert.ToDateTime(maskedTextBox3.Text); } catch (Exception ex) { MessageBox.Show("Lam Gi Day"); Truoc = new DateTime(0, 0, 0); Sau = new DateTime(0, 0, 0); } frmBaoCaorpt bc = new frmBaoCaorpt(Truoc, Sau); bc.Show(); this.Close(); } }
private void button3_Click(object sender, EventArgs e) { frmBaoCaorpt bc = new frmBaoCaorpt(3); bc.ShowDialog(); }