StatusBar Question

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?
 
T

Thorsten Doerfler

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
 
C

Chris Dunaway

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.
 
G

Guest

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.
 

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

Top