I have a DateTimePicker. The user should pick the first of the month. If he
doesn't, the ValueChanged event pops a messagebox and changes the value to
the first. Problem is that changing the Value in the event triggers the event
twice, and the messagebox appears twice, though I don't see why it should.
Any explanation?
private void dtpRenew_ValueChanged(object sender, System.EventArgs e)
{
int day = dtpRenew.Value.Day ;
if(day != 1)
{ MessageBox.Show("Starting Date must be first day of the month!") ;
dtpRenew.Value = dtpRenew.Value.AddDays(1-day) ;
}
}