Einar,
It doesn't seem that the StatusBar object has an itemcount...I looked for StatusBar.Panels.Count and other things, and didn't come across any.
I'm going to check again and also look it up, because I'm a little surprised that a particular collection doesn't have a count prop, but I believe this should work for now...
int nCount = 0;
foreach(object oo in this.statusBar1.Panels)
nCount++;
Kevin