Wednesday, 21 August 2013

Increasing date by the hour

Increasing date by the hour

Each time I click on the hour button or minute button it should populate a
textbox and increase the hour by 1 each button click within a 24 hour
format. The same applies for the minute button. Currently it is not
iterating and is only increasing by one only once.
private void Cld_SelectedDateChanged(object
sender,vhCalendar.SelectedDateChangedEventArgs e)
{
textBox1.Text = e.NewDate.ToString();
txtHH.Text = DateTime.Now.Hour.ToString();
txtMM.Text = DateTime.Now.Minute.ToString();
}
private void btnAddHour_Click( object sender, RoutedEventArgs e )
{
txtHH.Text = DateTime.Today.AddHours( 1 ).ToString("HH");
}
private void btnAddMinute_Click( object sender, RoutedEventArgs e )
{
txtMM.Text = DateTime.Today.AddMinutes( 1 ).ToString( "mm" );
}

No comments:

Post a Comment