StatusBar Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have added panels to a statusbar control using the .Add Method. I want to
determine how many panels there are in another part of the program. I tried;

'There is no count property exposed so this doesn't work;
mystatusbar.Panels.Count

I tried counting but this gives a runtime error;
dim i as integer
while p as panel in mystatusbar.panels
i=i+1
end while

Does anyone know how to find the no. of panels in the control?
 
Dennis said:
I have added panels to a statusbar control using the .Add Method. I want to
determine how many panels there are in another part of the program. I tried;

'There is no count property exposed so this doesn't work;
mystatusbar.Panels.Count

Did you try it? IntelliSense doesn't show it, but the
StatusBarPanelCollection has a Count property.
I tried counting but this gives a runtime error;
dim i as integer
while p as panel in mystatusbar.panels
i=i+1
end while

For Each suits better, furthermore it's StatusBarPanel:
Dim i As Integer

For Each p As StatusBarPanel In StatusBar1.Panels
i += 1
Next

Thorsten Doerfler
 
If you don't see the Count property, check your settings and make sure
you have "Hide Advanced Members" unchecked. Perhaps Intellisense is
just not showing the Count property.
 
Thanks. The For Each p as StatusBarPanel in myStatusBar.Panels works. Also,
now the myStatusBar.Panels.Count works as well. I swear I tried the count
before and it gave me a compile error saying that this was a protected
property.

Thanks again.
 
Back
Top