I'm trying to populate the task start/end dates and they keep changing. I have TaskWorkingHourMode set to MANUAL on my CalendarInfo object. If I set the start date and duration, the dates turn into something weird. If I set the start and end, the end turns into the start date and the duration is zero.
Hi Richard,
Setting the dates should work normally. I tried this out in a small sample and did not find any unexpected behavior. Please provide the code that you are using to set up your tasks and I will check into what is going wrong. If you would prefer not to upload your code to the public forum, let me know and I will open a private case for you.
I've tried three different approaches and none of them seem to work. TaskWorkingHourMode is set to MANUAL in all cases. See below.
Approach 1 (start and end times displayed in Gantt change to strange values)
Dim JobTask As Task = Me.UltraCalendarInfo1.Tasks.Add(StartTime, EndTime.Subtract(StartTime), JobNumber, strProjectKey)
Approach 2 (end time changes to start time as soon as I set it)
Dim JobTask As New Task() JobTask.Name = JobNumber JobTask.Project = NewProject JobTask.StartDateTime = StartTime JobTask.EndDateTime = EndTimeMe.UltraCalendarInfo1.Tasks.Add(JobTask)
Approach 3 (times change to strange values like in the first approach)
Dim JobTask As New Task() JobTask.Name = JobNumber JobTask.Project = NewProject JobTask.StartDateTime = StartTimeIf EndTime.Subtract(StartTime).TotalHours > 24 Then 'show as days... JobTask.SetDuration(EndTime.Subtract(StartTime), TimeSpanFormat.Days)ElseIf EndTime.Subtract(StartTime).TotalMinutes > 60 Then 'show as hours... JobTask.SetDuration(EndTime.Subtract(StartTime), TimeSpanFormat.Hours)Else 'show as minutes... JobTask.SetDuration(EndTime.Subtract(StartTime), TimeSpanFormat.Minutes)End If Me.UltraCalendarInfo1.Tasks.Add(JobTask)