|
-
Jan 6th, 2003, 07:14 PM
#1
Thread Starter
Junior Member
Using the MDI Parent from a Child Form
There are two forms in my project, frmParent (the MDI Parent) and frmChild (the MDI Child). On frmParent there is a status bar. How do I change the properties of the status bar from a child form (frmChild)?
-
Jan 6th, 2003, 09:56 PM
#2
PowerPoster
Not 100% sure, but isn't there a parent property of the MDI child form?
Try something like this in the Child form:
Me.Parent.theProgressBar
You might need to set the progressbar to public in order to access it.
I can't verify this stuff right now, I am not at a machine with .Net installed.
-
Jan 6th, 2003, 10:07 PM
#3
PowerPoster
Another thing to try, is if you can't get
Me.Parent.theProgressBar
to work is to try to cast the parent into a local object.
Example:
Dim frm As frmParent
frm = Me.Parent
Then use the frm varible to access the progress bar.
frm.ProgressBarName
-
Jan 6th, 2003, 10:27 PM
#4
Thread Starter
Junior Member
Nope, the closest thing to Me.Parent is Me.ParentForm, and the app errors if I do the following:
Me.ParentForm.StatusBar1.Text = "Yay, this finally worked"
The error, StatusBar1 is not contained within System.Forms.Form (or something similar).
-
Jan 7th, 2003, 03:48 AM
#5
Registered User
To get to the statusbar you of course have to reference the Main form in any way but to get a variable "to know" what controls are on the form you have to declare one as the Main form. Uhhh taht sounded like it didn't make sence..... I'll try with an example:
Code:
Dim frm As frmMain = Me.ParentForm
frm.sbMain.Text = "Schnabel"
That should work.....
What I was trying to say in the beginning was that if you use only Me.ParenForm. then the application can't determine what kind of form is your parent form, so it does not know what controls are listed in the form, but as you declare it (Dim frm As frmMain) the application knows it is an instance of the mainform and also then knows that there is a Statusbar on it. If you don't declare the form the application only knows that it is a Parentform, not what kind of form it is.
Last edited by Athley; Jan 7th, 2003 at 03:51 AM.
-
Jan 7th, 2003, 07:36 AM
#6
Thread Starter
Junior Member
Grand it works! Thanks for you're help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|