Dean,
I agree with Chris.
Or you can modify your code as follows.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim obj As Control
Dim str As String
Dim pnl As StatusBar.StatusBarPanelCollection
For Each obj In Me.Controls
str = obj.GetType.ToString
Select Case str
Case "System.Windows.Forms.StatusBar"
pnl = CType(obj, StatusBar).Panels
pnl(0).Text = "Edit"
pnl(1).Text = "Ready for update"
pnl(2).Text = Today.ToShortDateString
End Select
Next
End Sub
If you have any conern on this question, please post here.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure!
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: "Dean Slindee" <sl*****@mindspring.com>
Subject: How to refer to status bar panels thru object syntax?
Date: Mon, 24 Nov 2003 12:26:06 -0600
Lines: 44
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.0
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Message-ID: <OC*************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: 0-1pool36-40.nas14.milwaukee1.wi.us.da.qwest.net
63.156.36.40Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
..phx.gbl!tk2msftngp13.phx.gblXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.vb:158717
X-Tomcat-NG: microsoft.public.dotnet.languages.vb
Is there any way to refer to the .text property of a status bar panel thru
object syntax,
like below (the inner "for" does not work):
Public Function FormStatusBarPaint(ByVal frm As Form) As Integer
Dim obj As New Control
Dim str As String
Dim pnl As StatusBar.StatusBarPanelCollection
For Each obj In frm.Controls
str = obj.GetType.ToString
Select Case str
Case "System.Windows.Forms.StatusBar"
For Each pnl In obj.Controls
pnl(0).Text = "Edit"
pnl(1).Text = "Ready for update"
pnl(2).Text = Today.ToShortDateString
Next
End Select
Next
End Function
Thanks,
Dean Slindee