Controls in tabel

A

anonymou

I am trying to loop in table to set all controls visible.
What is incorrect in my code?
Dim control As System.Web.UI.WebControls.WebControl
Dim Table1 As System.Web.UI.WebControls.Table
For Each control In Table1
control.Visible = True
Next
 
E

Eliyahu Goldin

Should be rather For Each control In Table1.Controls. Note, that Controls
property gives your only child controls for the control. To get the full
list of controls use recursion.

Eliyahu
 
A

anonymous

I get this error msg:'Object reference not set to an
instance of an object'
Below is my code :
Dim control As System.Web.UI.WebControls.WebControl
Dim Table1 As System.Web.UI.WebControls.Table
For Each control In Table1.Controls
control.Visible = True
Next
 
E

Eliyahu Goldin

Dim is a declaration statement. It just declares variable Table1. You need
to instantiate it.

Eliyahu
 
E

Eliyahu Goldin

Dim is a declaration statement. It just declares variable Table1. You need
to instantiate it.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top