473,378 Members | 1,152 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,378 software developers and data experts.

activate Statusbar from mdichild form

rat
i am having 3 panels(0,1 & 2) in a Statusbar.

Using MDI form, i can access and set the text for the
panels(0 and 2)..

But how can i access the panel(1) from MDI Child form.
like frmmdi.SB.Panels(1).text = "files saved.."

frmmdi --> Mdi Form name
SB --> StatusBar

Advanced Thanks.
regards,
Rat
Nov 20 '05 #1
4 2079
Howdy Rat,

Each Mdi child form (class RattyForm) has an MdiParent property. This
property has the type Form, whereas your Mdi parent Form is more special than
that - class RattusForm. What you must do, therefore, is cast your RattyForm's
MdiParent to the right type.

In a RattyForm
Dim sbRat As StatusBar = DirectCast (Me.MdiParent, RattusForm).SB
sbRat.Panels (1) = "Files nibbled."

That's the quick and direct way. But what if, one day you decide to change
those panels around or add one, etc? Will you have to change that '1' is all
RattyForms? Yep. What if perchance you miss one? [Not a chance - for are you
not the Rat?!]

But is there an alternative? Yep again.

Have a method on the RattusForm which will set that Panel for the Ratties.

'Not required but recommended. Could even use an Enum.
Private Const kRattusPanelA As Integer = 0
Private Const kRattyPanel As Integer = 1
Private Const kRattusPanelB As Integer = 2

Public Sub SetRattyInfo (sRattyString As String)
Me.Panels (kRattyPanel) = sRattyString
End Sub

This allows you to change your status bar panels at will and only have to
change the constants at the top of RattusForm.

And now, in the RattyForms, you'd have this perfectly stable code.

DirectCast (Me.MdiParent, RattusForm).SetRattyInfo ("Files nibbled.")

Regards,
Fergus

ps I'm a Cat but I've just eaten so you're safe! ;-)
Nov 20 '05 #2
Hi Fergus alias (cat)

Thanks, its realy useful for me right now.

thanks once again.

Regards,
Rat
-----Original Message-----
Howdy Rat,

Each Mdi child form (class RattyForm) has an MdiParent property. Thisproperty has the type Form, whereas your Mdi parent Form is more special thanthat - class RattusForm. What you must do, therefore, is cast your RattyForm'sMdiParent to the right type.

In a RattyForm
Dim sbRat As StatusBar = DirectCast (Me.MdiParent, RattusForm).SB sbRat.Panels (1) = "Files nibbled."

That's the quick and direct way. But what if, one day you decide to changethose panels around or add one, etc? Will you have to change that '1' is allRattyForms? Yep. What if perchance you miss one? [Not a chance - for are younot the Rat?!]

But is there an alternative? Yep again.

Have a method on the RattusForm which will set that Panel for the Ratties.
'Not required but recommended. Could even use an Enum. Private Const kRattusPanelA As Integer = 0
Private Const kRattyPanel As Integer = 1
Private Const kRattusPanelB As Integer = 2

Public Sub SetRattyInfo (sRattyString As String)
Me.Panels (kRattyPanel) = sRattyString
End Sub

This allows you to change your status bar panels at will and only have tochange the constants at the top of RattusForm.

And now, in the RattyForms, you'd have this perfectly stable code.
DirectCast (Me.MdiParent, RattusForm).SetRattyInfo ("Files nibbled.")
Regards,
Fergus

ps I'm a Cat but I've just eaten so you're safe! ;-)
.

Nov 20 '05 #3
* "rat" <an*******@discussions.microsoft.com> scripsit:
i am having 3 panels(0,1 & 2) in a Statusbar.

Using MDI form, i can access and set the text for the
panels(0 and 2)..

But how can i access the panel(1) from MDI Child form.
like frmmdi.SB.Panels(1).text = "files saved.."

frmmdi --> Mdi Form name
SB --> StatusBar


\\\
DirectCast(Me.MdiChildren(1), ChildForm).StatusBar1.Panels(1).Text
///

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Oops
Nov 20 '05 #5

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

Similar topics

0
by: Supra | last post by:
i got mdichild working. i'm working on similar to mirc chat. when i joined channel #vb the first mdichild is on. then when i wanted to join another channel #visualbasic. then i got second mdichild...
1
by: Mickey Swanson | last post by:
I have a MDI app wich has several different forms I need to call a method on one MDIchild form from another child form. I have a MDI form called frmMDI. I have a mdichild form called frmMain....
6
by: Claus Holm | last post by:
I'm trying to enable a menuitem in the parent form from a mdichild. Rather than making the menuitems public, I'd go for a public method in the parent form to do the change, but when I call the...
2
by: SpotNet | last post by:
Hello NewsGroup, I have a MDIParent form with a docked left treeview control, a splitter control and a generic docked control on the right. Kind of looks like Windows Explorer, though it's...
9
by: Christian Blackburn | last post by:
Hi Gang, I've had this happen with a couple of controls now, but my patience has worn thin. Can somebody tell me why I can read/write to most objects on my form from my module, but not when...
0
by: crangel | last post by:
Hi i´m develop one app multi-document, is a similar MsWord application I have one MDI Form, that lodges several MDIChild, every time that closed one I make a trigger process, but when I...
1
by: LCAdeveloper | last post by:
Can anyone help me with this? I'm trying to get an MDIChild form to lookup the value of a control on another open MDIChild form, but can't seem to get the right syntax. Let's say the two child...
0
by: Supra | last post by:
i got mdichild working. i'm working on similar to mirc chat. when i joined channel #vb the first mdichild is on. then when i wanted to join another channel #visualbasic. then i got second mdichild...
0
by: Supra | last post by:
i got code working. similar to mirc chat. but what happen when i joined the channel #visualbasic...that fine with me , i got all data coming into first mdichild. but when i joined another channel...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...

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.