palehorse
Active member
- Joined
- Jan 28, 2005
- Messages
- 34
- Programming Experience
- 1-3
Hello everyone,
I am trying to generate a table on my form with rows/cells. I can do this fine with response.write; however, I am trying to pull away from that. What I am using is this:
[/size]But this doesn't work. I get the following at tbl.Rows.Add(tr) What am I doing wrong?
Object reference not set to an instance of an object.
Also - if I set tbl = New Table, I get the same error at phfiles.controls.add(tbl)
[/size]
I am trying to generate a table on my form with rows/cells. I can do this fine with response.write; however, I am trying to pull away from that. What I am using is this:
VB.NET:
[color=#0000ff]Dim[/color] tr [color=#0000ff]As[/color] TableRow
[color=#0000ff]Dim[/color] td [color=#0000ff]As[/color] TableCell
[color=#0000ff]Dim[/color] tbl [color=#0000ff]As[/color] Table
[color=#0000ff]Dim[/color] ph[color=#0000ff]As[/color] PlaceHolder
[size=3][size=2]tr = [color=#0000ff]New[/color] TableRow[/size]
td = [color=#0000ff]New[/color] TableCell
td.Controls.Add([color=#0000ff]New[/color] LiteralControl("Hello World"))
td.Attributes.Add("style", "width:4px; color:steelblue; font-size:2;")
tr.Cells.Add(td)
tbl.Rows.Add(tr)
[size=3][size=2]ph.Controls.Add(tbl)[/size]
Object reference not set to an instance of an object.
Also - if I set tbl = New Table, I get the same error at phfiles.controls.add(tbl)
[/size]
Last edited: