473,809 Members | 2,826 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Panel s(1).text = "files saved.."

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

Advanced Thanks.
regards,
Rat
Nov 20 '05 #1
4 2101
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).Set RattyInfo ("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).Set RattyInfo ("Files nibbled.")
Regards,
Fergus

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

Nov 20 '05 #3
* "rat" <an*******@disc ussions.microso ft.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.Panel s(1).text = "files saved.."

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


\\\
DirectCast(Me.M diChildren(1), ChildForm).Stat usBar1.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
1434
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 on. the first mdichild(#vb) is stopped responding and all #vb goes into combination of second mdichild(#visualbasic)... and in second mdichild i got both responding from both #vb and #visualbasic intot second mdichild(#visualbasic). but how do i...
1
3091
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. I have a mdichild form called frmDetails. after saving changes to frmDetails I need to update frmMain
6
6229
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 method from the mdichild, I get this error: C:\MyProjects\Visual Studio Projects\Tournament\Forms\frmLogin.cs(69): The name 'test' does not exist in the class or namespace 'Tournament.frmLogin' frmLogin is the mdichild.
2
7377
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 functionality is quite different. I have a function where an MDIChild is activated, well attempted to do so. When I call the MDIChild form, I get the form caption (on the MDIParent) of the MDIChild and its' control menus but the client area still has...
9
2085
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 working with StatusBar.Text? Thanks in Advance, Christian Blackburn My Code: Public Class frmMain
0
1134
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 close the last Form opened does not complete do it, I was using the Activate of forms to call the process but in my form father not it shoots Activate event when I close the last form child.
1
4892
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 forms are Form1 and Form2. In VB4 I could use (in Form2): \\ If Form1.Option1.Value = True Then //
0
1231
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 on. the first mdichild(#vb) is stopped responding and all #vb goes into combination of second mdichild(#visualbasic)... and in second mdichild i got both responding from both #vb and #visualbasic intot second mdichild(#visualbasic). but how do i...
0
1165
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 #vb, i got both #visualbasic and #vb data into second mdichild. but first mdichild is not activated anymore. but how do i passed data goes # visualbasic to first mdichild and #vb goes to second mdichild. i am attemptinjg figured out...
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10375
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10114
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3860
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.