Hey everyone,

I'm exceptionally new to VB.Net and Windows forms, and this has got me stumped.

I have created a tiny little app which has 4 panels.
By default, all panels are invisible.
The list of panel names is stored in an array.

Code:
Dim aryPanels() As System.Windows.Forms.Panel = {Panel1, Panel2, Panel3, Panel4}
From a sub I try to set the parameter 'Visible = True' like so...

Code:
aryPanels(UBound(aryPanels)).Visible = True
or

Code:
aryPanels(1).Visible = True
which in my mind should be the equivalent of this:

Code:
Panel2.Visible = True
The latter works from the sub when it's hardcoded. The first, which is what I need to do, does not.

I'd like to attach the project but can't see where, but if anyone can tell me how I can set parameters of Panels in an array, I'd be hugely grateful!

Thanks,
Scott