I am trying to create a set of functions so that I can dynamically and
programmatically create a table.
The table will be a calendar when it is displayed on the screen and has 5
types of cells.. Month header, Date, Info, Contents, and Filler.
This is the code that I am using:
Private Sub Page_Load(...
Build Calendar()
End Sub
Private Sub BuildCalender()
Table1.Rows.Add(BuildRow(1,Today())
End Sub
Function BuildRow(byval type as integer, byval sDate as Date) as TableRow
BuildRow.Cells.Add(BuildCell(1,1))
End Function
Function BuildCell(byval type as integer, byval contents as integer) as
TableCell
Select Case Type
Case 1 ' Month
BuildCell.BorderStyle = BorderStyle.Ridge
BuildCell.BackColor = BuildCell.BorderColor
BuildCell.Text = "Test Month Text"
BuildCell.Height.Pixel(24)
BuildCell.RowSpan = 14
End Select
End Function
When I try to run this I get an error "Object reference not set to an
instance of an object." on line 41 which is
BuildRow.Cells.Add(BuildCell(1,1))
Any help with this would be great!
Thanks in advance,
GaryO