Dean,
I agree with Chris.
Or you can modify your code as follows.
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim obj As Control
Dim str As String
Dim pnl As StatusBar.Statu sBarPanelCollec tion
For Each obj In Me.Controls
str = obj.GetType.ToS tring
Select Case str
Case "System.Windows .Forms.StatusBa r"
pnl = CType(obj, StatusBar).Pane ls
pnl(0).Text = "Edit"
pnl(1).Text = "Ready for update"
pnl(2).Text = Today.ToShortDa teString
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*****@mindsp ring.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.publi c.dotnet.langua ges.vb
NNTP-Posting-Host: 0-1pool36-40.nas14.milwau kee1.wi.us.da.q west.net
63.156.36.40Path:
cpmsftngxa07.ph x.gbl!cpmsftngx a10.phx.gbl!TK2 MSFTNGXA05.phx. gbl!TK2MSFTNGP0 8
..phx.gbl!tk2ms ftngp13.phx.gblXref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:158717
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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 FormStatusBarPa int(ByVal frm As Form) As Integer
Dim obj As New Control
Dim str As String
Dim pnl As StatusBar.Statu sBarPanelCollec tion
For Each obj In frm.Controls
str = obj.GetType.ToS tring
Select Case str
Case "System.Windows .Forms.StatusBa r"
For Each pnl In obj.Controls
pnl(0).Text = "Edit"
pnl(1).Text = "Ready for update"
pnl(2).Text = Today.ToShortDa teString
Next
End Select
Next
End Function
Thanks,
Dean Slindee