I have a form with a tabcontrol.
On this tabcontrol I have a panel taking up the entire tabpage
In this panel I have buttons etc and a datagridview
I am trying to cycle through the controls and panels to set the enabled to either true or false.
If I do this:
C is the panel
but CC only identifies the datagridview?
However if I do this:
p = the panel
c = all the controls including the datagridview
but after it has done that it errors on the next cycle through whereby it errors saying at the line For Each p In t.Controls that it cannot convert datagridview to a panel???
But why is it trying to do this there is only one panel so it should not cycle round for another run?
On this tabcontrol I have a panel taking up the entire tabpage
In this panel I have buttons etc and a datagridview
I am trying to cycle through the controls and panels to set the enabled to either true or false.
If I do this:
VB.NET:
For Each t In Me.TabControl1.TabPages
For Each c In t.Controls
For Each cc In c.Controls
Next
Next
Next
C is the panel
but CC only identifies the datagridview?
However if I do this:
VB.NET:
For Each t In Me.TabControl1.TabPages
For Each p In t.Controls
For Each c In p.Controls
Next
Next
Next
p = the panel
c = all the controls including the datagridview
but after it has done that it errors on the next cycle through whereby it errors saying at the line For Each p In t.Controls that it cannot convert datagridview to a panel???
But why is it trying to do this there is only one panel so it should not cycle round for another run?