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)
I noticed that my start/end only get overwritten when dependencies have been established. If I comment out the code that establishes the dependencies between tasks, my start/end dates are what I specified. Can you confirm that by establishing dependencies between tasks turns the start/end dates into "calculated" or essentially read-only values?
This shouldn't be happening. UltraGanttView can detect if the start/end times don't match up or make sense in relation to dependent tasks, and it will show an error if the relationship ends up being impossible. Barring that, it should work with the dates you specify.
Please send a sample application that I can view to better understand the specifics of the weird behavior you are seeing and the relationships present in the dates/times involved with your setup.