G
Guest
Hi,
I would like to load time in a dropdown similar to the outlook calendar
appointment time dropdown.
Here is how I do this:
comboboxTimer.Items.Add( (object) "12:00 AM" );
comboboxTimer.Items.Add( (object) "12:30 AM" );
for(int i=1; i<=11; i++)
{
comboboxTimer.Items.Add( (object)( i.ToString() + ":00 AM") );
comboboxTimer.Items.Add( (object)( i.ToString() + ":30 AM") );
}
comboboxTimer.Items.Add( (object) "12:00 PM" );
comboboxTimer.Items.Add( (object) "12:30 PM" );
for(int i=1; i<=11; i++)
{
comboboxTimer.Items.Add( (object)( i.ToString() + ":00 PM") );
comboboxTimer.Items.Add( (object)( i.ToString() + ":30 PM") );
}
The simplest way I could think of for now. Okay now I use this on 2 combo
boxes. THe first one is a start time and the later the end time. On the
SelectedIndexChanged event of the start time I do the followinig:
private void DateStartTime_SelectedIndexChanged(object sender,
System.EventArgs e) {
//DateStartTime.OnLoad(this.DateStartTime.SelectedValue.ToString(),
this.DateEndTime.SelectedValue.ToString());
DateTime start;
DateTime end;
start = Convert.ToDateTime(DateStartTime.SelectedValue);
end = start.AddMinutes(30);
this.DateEndTime.SelectedValue = end.ToShortTimeString();
}
All works find. I would like to add an extra feature I could not come up
with a solution yet and perhaps you can help me out here. I would like to add
the minutes and hours difference between start and end times respectively. I
would like it concatenated with my end time dropdown... Exactly like when you
use the new appoinmtent for from Outlook.
Any suggestions or ideas?
Thanks,
Yama
I would like to load time in a dropdown similar to the outlook calendar
appointment time dropdown.
Here is how I do this:
comboboxTimer.Items.Add( (object) "12:00 AM" );
comboboxTimer.Items.Add( (object) "12:30 AM" );
for(int i=1; i<=11; i++)
{
comboboxTimer.Items.Add( (object)( i.ToString() + ":00 AM") );
comboboxTimer.Items.Add( (object)( i.ToString() + ":30 AM") );
}
comboboxTimer.Items.Add( (object) "12:00 PM" );
comboboxTimer.Items.Add( (object) "12:30 PM" );
for(int i=1; i<=11; i++)
{
comboboxTimer.Items.Add( (object)( i.ToString() + ":00 PM") );
comboboxTimer.Items.Add( (object)( i.ToString() + ":30 PM") );
}
The simplest way I could think of for now. Okay now I use this on 2 combo
boxes. THe first one is a start time and the later the end time. On the
SelectedIndexChanged event of the start time I do the followinig:
private void DateStartTime_SelectedIndexChanged(object sender,
System.EventArgs e) {
//DateStartTime.OnLoad(this.DateStartTime.SelectedValue.ToString(),
this.DateEndTime.SelectedValue.ToString());
DateTime start;
DateTime end;
start = Convert.ToDateTime(DateStartTime.SelectedValue);
end = start.AddMinutes(30);
this.DateEndTime.SelectedValue = end.ToShortTimeString();
}
All works find. I would like to add an extra feature I could not come up
with a solution yet and perhaps you can help me out here. I would like to add
the minutes and hours difference between start and end times respectively. I
would like it concatenated with my end time dropdown... Exactly like when you
use the new appoinmtent for from Outlook.
Any suggestions or ideas?
Thanks,
Yama