stustarz Posted January 15, 2003 Posted January 15, 2003 I am using an MDI in my application which has a progress bar on the bottom. I would like to control this progress bar from within the child MDI's. E.g Click button on Child FOrm 1 that loads child form 2 - progress bar on MDI parent shows progress. Thanks for any help you give. Quote Visit: VBSourceSeek - The VB.NET sourcecode library "A mere friend will agree with you, but a real friend will argue."
*Experts* Nerseus Posted January 15, 2003 *Experts* Posted January 15, 2003 You'll need to somehow get access to that control or to a method/property that can set the control. There's a couple of ways to do this. The easiest is probably to pass a reference to *exact* type of MDIForm to the child forms. So if your MDI form's class is named "frmMain", then add a parameter to the contstructor of Form1 like so (C#): private frmMain myParent; public Form1 (frmMain myParent) { this.myParent = myParent; } private void btnClick(...) { myParent.progressBar1.Value = 50; } The above assumes that the modifier for frmMain's progress bar is set to Public instead of the default private. When frmMain creates an instance of Form1, it would use something like this: private void mnuClick(...) { // Pass "this" to the constructor of Form1 so // that it has a reference and can reach progressBar1 Form1 f = new Form1(this); f.MDIParent = this; f.Show(); } -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.