Hi
I read the sample and did the same but an error occurs on the line :
this.ugvProjects.CalendarInfo = this.uciGantt;
With NullreferenceException
Here my code :
ugvProjects is my UltraGanttView Control on winformuciGantt is my ultracalendarInfo control on winform
private void LoadGantt() { DataSet ds = new DataSet();
ds.Tables.Add("PROJECTS"); ds.Tables[0].Columns.Add("ProjectID"); ds.Tables[0].Columns.Add("ProjectKey"); ds.Tables[0].Columns.Add("ProjectName"); ds.Tables[0].Columns.Add("ProjectStartTime" ,typeof(DateTime)); ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["ProjectID"] = Guid.NewGuid(); ds.Tables[0].Rows[ds.Tables[0].Rows.Count-1]["ProjectKey"]="Key1"; ds.Tables[0].Rows[ds.Tables[0].Rows.Count-1]["ProjectName"]="Key 1 project name"; ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["ProjectStartTime"] = DateTime.Now.ToShortDateString();
ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["ProjectID"] = Guid.NewGuid(); ds.Tables[0].Rows[ds.Tables[0].Rows.Count-1]["ProjectKey"]="Key2"; ds.Tables[0].Rows[ds.Tables[0].Rows.Count-1]["ProjectName"]="Key 2 project name"; ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["ProjectStartTime"] = DateTime.Now.ToShortDateString();
ds.Tables.Add("TASKS"); ds.Tables[1].Columns.Add("TaskID"); ds.Tables[1].Columns.Add("ProjectKey"); ds.Tables[1].Columns.Add("TaskName"); ds.Tables[1].Columns.Add("TaskStartTime", typeof(DateTime)); ds.Tables[1].Columns.Add("TaskDuration"); ds.Tables[1].Columns.Add("ParentTaskID"); ds.Tables[1].Columns.Add("TaskConstraint"); ds.Tables[1].Columns.Add("TaskPercentComplete"); ds.Tables[1].Columns.Add("AllProperties");
ds.Tables[1].Rows.Add(ds.Tables[1].NewRow()); ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskID"] = Guid.NewGuid(); ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["ProjectKey"] = "Key1"; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskName"] = "task 1 name"; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskStartTime"] = DateTime.Now.ToShortDateString(); ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskDuration"] = 60; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["ParentTaskID"] = ds.Tables[0].Rows[0]["ProjectID"]; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskConstraint"] = "StartNoEarlierThan"; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskPercentComplete"] = null; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["AllProperties"] = null;
ds.Tables[1].Rows.Add(ds.Tables[1].NewRow()); ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskID"] = Guid.NewGuid(); ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["ProjectKey"] = "Key1"; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskName"] = "task 2 name"; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskStartTime"] = DateTime.Now.AddDays(60).ToShortDateString(); ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskDuration"] = 40; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["ParentTaskID"] = ds.Tables[0].Rows[0]["ProjectID"]; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskConstraint"] = "StartNoEarlierThan"; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskPercentComplete"] = null; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["AllProperties"] = null;
ds.Tables[1].Rows.Add(ds.Tables[1].NewRow()); ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskID"] = Guid.NewGuid(); ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["ProjectKey"] = "Key2"; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskName"] = "task 3 name"; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskStartTime"] = DateTime.Now.AddDays(10).ToShortDateString(); ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskDuration"] = 15; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["ParentTaskID"] = ds.Tables[0].Rows[1]["ProjectID"]; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskConstraint"] = "StartNoEarlierThan"; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["TaskPercentComplete"] = null; ds.Tables[1].Rows[ds.Tables[1].Rows.Count - 1]["AllProperties"] = null;
this.uciGantt.DataBindingsForTasks.BindingContextControl = this; this.uciGantt.DataBindingsForProjects.BindingContextControl = this;
this.uciGantt.DataBindingsForProjects.SetDataBinding(ds, "Projects"); this.uciGantt.DataBindingsForProjects.IdMember = "ProjectID"; this.uciGantt.DataBindingsForProjects.KeyMember = "ProjectKey"; this.uciGantt.DataBindingsForProjects.NameMember = "ProjectName"; this.uciGantt.DataBindingsForProjects.StartDateMember = "ProjectStartTime";
this.uciGantt.DataBindingsForTasks.SetDataBinding(ds, "Tasks"); this.uciGantt.DataBindingsForTasks.NameMember = "TaskName"; this.uciGantt.DataBindingsForTasks.DurationMember = "TaskDuration"; this.uciGantt.DataBindingsForTasks.StartDateTimeMember = "TaskStartTime"; this.uciGantt.DataBindingsForTasks.IdMember = "TaskID"; this.uciGantt.DataBindingsForTasks.ProjectKeyMember = "ProjectKey"; this.uciGantt.DataBindingsForTasks.ParentTaskIdMember = "ParentTaskID"; this.uciGantt.DataBindingsForTasks.ConstraintMember = "TaskConstraint"; this.uciGantt.DataBindingsForTasks.PercentCompleteMember = "TaskPercentComplete"; this.uciGantt.DataBindingsForTasks.AllPropertiesMember = "AllProperties";
this.ugvProjects.CalendarInfo = this.uciGantt; this.ugvProjects.Project = this.ugvProjects.CalendarInfo.Projects[1];
}
Thank you very much.
Hi,
http://help.infragistics.com/Help/Doc/WinForms/2012.1/CLR2.0/HTML/WinGanttView_DataBinding_Support_for_WinGanttView.html
Using the GetSampleData function, doesn't seem to crash but control is in error with a big Red cross image when running.
Which sample are you referring to? Is it one of the samples that is installed with Infragistics? If so, which one? Is it a sample that you put together based on our documentation? If so, could you post it here so that I could test it myself?
The problem is still here ...
Error occurs in this method
à Infragistics.Win.UltraWinSchedule.TasksDataBinding.FullSynchronization(IList itemList, IList boundList)