473,399 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

How to refer to status bar panels thru object syntax?

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
Nov 20 '05 #1
2 1369
On Mon, 24 Nov 2003 12:26:06 -0600, Dean Slindee wrote:

See Notes below
Is there any way to refer to the .text property of a status bar panel thru
object syntax,
Public Function FormStatusBarPaint(ByVal frm As Form) As Integer

Dim obj As New Control

Dim str As String
Dim pnl As StatusBarPanel
For Each obj In frm.Controls

str = obj.GetType.ToString

Select Case str

Case "System.Windows.Forms.StatusBar"

You have to cast the obj variable to be a statusbar:

For Each pnl In CType(obj,StatusBar).Panels
pnl.Text = "Edit"

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 20 '05 #2
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


Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ada | last post by:
i have a little bit of issue getting the status bar to work properly. this is what happens now. when the program loaded, the status is "READY..." the code is inside the FORM LOAD. i also...
1
by: William Oliveri | last post by:
Hi all, I'm writing some code for disaster recovery. I need to have an application which accesses Sql Server to determine if the local database is up or not and then if not go to the secondary...
1
by: Ben | last post by:
Hi We have a number of Panels on our windows form, we have controls inside and outside of the panels. I am having problems tabbing between controls, it appers to be when the controls are...
2
by: =?Utf-8?B?Um9ja3k=?= | last post by:
If the network cable is unplugged I need to change an image on my main form status bar, however this does not work ' The computer has been connected or disconnected from the network If...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.