foreach (DataRelation rs in dbComm.ds.Relations) { Debug.WriteLine(rs.RelationName); Debug.WriteLine(rs.ParentKeyConstraint.ConstraintName); Debug.WriteLine(rs.ChildKeyConstraint.ConstraintName); foreach (DataColumn col in rs.ChildColumns) { Debug.WriteLine(col.ColumnName); } foreach (DataColumn col in rs.ParentColumns) { Debug.WriteLine(col.ColumnName); } } for (int i = 0; i < this.ultraGanttView1.Project.Tasks.Count; i++) { if(this.ultraGanttView1.Project.Key == this.ultraGanttView1.Project.Tasks[i].ProjectKey) { Debug.WriteLine("SAME"); } else { Debug.WriteLine("NOT THE SAME"); } } UltraPrintPreviewDialog printPreview = new UltraPrintPreviewDialog(); printPreview.Document = this.ultraGanttViewPrintDocument1; this.ultraGanttViewPrintDocument1.GanttView = this.ultraGanttView1; printPreview.ShowDialog(this);//The error comes on this line
Error that I get:
Output that I get in the debugger:
Relation1 Constraint1 Relation1 ProjectKey ProjectKey SAME SAME 'ProjectPlanning.exe' (CLR v4.0.30319: ProjectPlanning.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Infragistics4.Win.UltraWinStatusBar.v17.2\v4.0_17.2.20172.2006__7dd5c3163f2cd0cb\Infragistics4.Win.UltraWinStatusBar.v17.2.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Exception thrown: 'System.Data.InvalidConstraintException' in System.Data.dll An exception of type 'System.Data.InvalidConstraintException' occurred in System.Data.dll but was not handled in user code ForeignKeyConstraint Relation1 requires the child key values () to exist in the parent table.
Thanks in advance,
Robbe
Hello Robbe,
Thank you for contacting Infragistics. I have not seen or read any reports of this behavior occurring elsewhere. Which event is this logic handled in?
You may also want to try swapping lines 28 and 29 before printing.
eg. this.ultraGanttViewPrintDocument1.GanttView = this.ultraGanttView1;printPreview.Document = this.ultraGanttViewPrintDocument1;
I've attached a sample below demonstrating the print preview working with the UltraGantt correctly. Please modify according to your application's specifications and isolate the behavior. I'll review your modifications and investigate this further for you.
Let me know if you have any questions.
PrintGanttView.zip
Hello Michael,
Thanks for anwsering. I know the printing of the ultraganttview works because it used to work. I think the problem has something to do with my database communication. I attached a simplified version of my code (database not included). I also get the same error when I'm adding resources to a task (when I press OK). It has something to do with a relation but I can't properly debug it because the error is always generated in code I can't access. So I'm hoping you can find what I'm doing wrong.
IFG_ProjectPlanning.zip