This sample code shows you how to add a Project with tasks to the UltraGanttView control.
Imports Infragistics.Win.UltraWinSchedule
Imports Infragistics.Win.UltraWinGanttView
Private Sub Tasks_Programmatically_Load(ByVal sender As Object, ByVal e As EventArgs)
' Create a new Project other than the Unassigned Project
Dim quarterlyProject As Project = Me.ultraCalendarInfo1.Projects.Add("QuartlerlyProject", DateTime.Today)
quarterlyProject.Key = "projkey1"
' Create a Summary or Parent Task
Dim requirementsTask As Task = Me.ultraCalendarInfo1.Tasks.Add(DateTime.Today, TimeSpan.FromDays(5), "Requirements", "projkey1")
' Create a child task
Dim budgetTask As Task = requirementsTask.Tasks.Add(DateTime.Today, TimeSpan.FromDays(2), "Budget Analysis")
' Set Deadline
budgetTask.Deadline = DateTime.Today.AddDays(3)
'Assign a Resource for this task
Dim budgetOwner As Owner = Me.ultraCalendarInfo1.Owners.Add("BudgetOwner", "Bill Isacky")
budgetTask.Resources.Add(budgetOwner)
' Create another child task
Dim teamTask As Task = requirementsTask.Tasks.Add(DateTime.Today.AddDays(3), TimeSpan.FromDays(2), "Team Allocation")
' Set a Constraint for this Task
teamTask.ConstraintDateTime = DateTime.Today.AddDays(4)
teamTask.Constraint = TaskConstraint.FinishNoLaterThan
' Create a Summary or Parent Task
Dim implemetationTask As Task = Me.ultraCalendarInfo1.Tasks.Add(DateTime.Now.AddDays(7), TimeSpan.FromDays(3), "Implementation", "projkey1")
' Create a child task
Dim frontendTask As Task = implemetationTask.Tasks.Add(DateTime.Now.AddDays(7), TimeSpan.FromDays(3), "GUI Design")
' Set this task as a Milestone
frontendTask.Milestone = True
' Set Percent Complete for this Task
frontendTask.PercentComplete = 40
frontendTask.Dependencies.Add(budgetTask, TaskDependencyType.StartToStart)
frontendTask.Dependencies.Add(teamTask, TaskDependencyType.FinishToStart)
Me.ultraGanttView1.CalendarInfo = Me.ultraCalendarInfo1
' Assign the new Project to GanttView so that this Project is shown in GanttView and not the unassigned Project.
Me.ultraGanttView1.Project = Me.ultraGanttView1.CalendarInfo.Projects(1)
End Sub
'Declaration
Public Property Project As Infragistics.Win.UltraWinSchedule.Project
using Infragistics.Win.UltraWinSchedule;
using Infragistics.Win.UltraWinGanttView;
private void Tasks_Programmatically_Load(object sender, EventArgs e)
{
// Create a new Project other than the Unassigned Project
Project quarterlyProject = this.ultraCalendarInfo1.Projects.Add("QuartlerlyProject", DateTime.Today);
quarterlyProject.Key = "projkey1";
// Create a Summary or Parent Task
Task requirementsTask = this.ultraCalendarInfo1.Tasks.Add(DateTime.Today, TimeSpan.FromDays(5), "Requirements", "projkey1");
// Create a child task
Task budgetTask = requirementsTask.Tasks.Add(DateTime.Today, TimeSpan.FromDays(2), "Budget Analysis");
// Set Deadline
budgetTask.Deadline = DateTime.Today.AddDays(3);
//Assign a Resource for this task
Owner budgetOwner = this.ultraCalendarInfo1.Owners.Add("BudgetOwner", "Bill Isacky");
budgetTask.Resources.Add(budgetOwner);
// Create another child task
Task teamTask = requirementsTask.Tasks.Add(DateTime.Today.AddDays(3), TimeSpan.FromDays(2), "Team Allocation");
// Set a Constraint for this Task
teamTask.ConstraintDateTime = DateTime.Today.AddDays(4);
teamTask.Constraint = TaskConstraint.FinishNoLaterThan;
// Create a Summary or Parent Task
Task implemetationTask = this.ultraCalendarInfo1.Tasks.Add(DateTime.Now.AddDays(7), TimeSpan.FromDays(3), "Implementation", "projkey1");
// Create a child task
Task frontendTask = implemetationTask.Tasks.Add(DateTime.Now.AddDays(7), TimeSpan.FromDays(3), "GUI Design");
// Set this task as a Milestone
frontendTask.Milestone = true;
// Set Percent Complete for this Task
frontendTask.PercentComplete = 40;
frontendTask.Dependencies.Add(budgetTask, TaskDependencyType.StartToStart);
frontendTask.Dependencies.Add(teamTask, TaskDependencyType.FinishToStart);
this.ultraGanttView1.CalendarInfo = this.ultraCalendarInfo1;
// Assign the new Project to GanttView so that this Project is shown in GanttView and not the unassigned Project.
this.ultraGanttView1.Project = this.ultraGanttView1.CalendarInfo.Projects[1];
}
'Declaration
Public Property Project As Infragistics.Win.UltraWinSchedule.Project
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2