Tables Inisde Tables throws weird exception

Tables Inisde Tables throws weird exception

Forum member · Sep 11, 2006
Hey, When putting a table inside a table, for some reason I'm getting a System.IndexOutOfRangeException. I've looked at my code (and pasted the part in question below), and I can't figure out why that particular exception would be thrown. Here's what I'm doing: I'm creating a table with some static data. Then I create a 2nd table, also with some static data. Then I create a third table and try to add the 2 previously created static data tables as Cells in 2 rows of the 3rd table. Line 12 in the exmple is the one throwsing the exception. 1 Table reportHeaderTable = new Table(); 2 ... rows of static text go in this table (labels and line objects) ... 3 4 Table colHeaderTable = new Table(); 5 ... this table also has static data (text that represents table columns... 6 7 Row row = null; 8 Cell cell = null; 9 Table templateTable = new Table(); 10 11 row = templateTable.rows.Add(reportHeaderTable.GetVisibleHeight()); 12 cell = row.Cells.Add(reportHeaderTable); 13 14 row = templateTable.rows.Add(colHeaderTable.GetVisibleHeight()); 15 cell = row.Cells.Add(colHeaderTable); Has anybody ever seen this before? later, -Mike

Re: Tables Inisde Tables throws weird exception

Forum member · Sep 11, 2006
nevermind, I figured it out...I forgot to add a Column to the Table!! d'oh >:(