Link to home
Start Free TrialLog in
Avatar of Peter Kiers
Peter KiersFlag for Netherlands

asked on

Convert int to timespan?

hi,

I have this:

        private void cbDays_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (cbDays.SelectedIndex)
            {
                case 0: schedulerControl.Views.DayView.TimeScale = 31; <====
                          break;
                case 1: schedulerControl.Views.DayView.TimeScale = 14;  <====
                          break;
                case 2: schedulerControl.Views.DayView.TimeScale = 7;   <====
                          break;
                case 3: schedulerControl.Views.DayView.TimeScale = 5;   <====
                          break;
                case 4: schedulerControl.Views.DayView.TimeScale = 3;   <====
                          break;
                case 5: schedulerControl.Views.DayView.TimeScale = 2;  <====
                          break;
                case 6: schedulerControl.Views.DayView.TimeScale = 1;  <====
                          break;
            }
       }

I get error:

Cannot implicitly convert type 'int' to 'System.TimeSpan'

How can I convert an integer to an timespan?

Peter
Avatar of p_davis
p_davis

= new Timespan(0, yourValueInMinutes,0)
Avatar of Peter Kiers

ASKER

How to implement your answer in this line:

case 6: schedulerControl.Views.DayView.TimeScale = 1;  <====
ASKER CERTIFIED SOLUTION
Avatar of p_davis
p_davis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.