private void button1_Click(object sender, EventArgs e) { if (dateTimePicker1.Value <= dateTimePicker2.Value) { bool b = WorkWithDB.AddDov(dateTimePicker1.Value, dateTimePicker2.Value); if (b == true) { } else { } } else { MessageBox.Show("Некорректно выбрана дата"); } }