Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 2nd, 2007, 03:19 PM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Controlling MDI child form from MDI parent panel

I have two forms MDI Parent (Master) and MDI child (Customer). On MDI Parent i have a panel which has the following buttons:

1. New
2. Edit
3. Save
4. Delete
5. Undo
6. Redo
7. First
8. Previous
9. Next
10. Last
11. Search
12. Print
13. Close

Now my problem is how do i control the data in the customer form with the buttons located at Master's panel ?

Reply With Quote
  #2 (permalink)  
Old April 3rd, 2007, 12:15 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

When you open the child, you should be able to get the handle to that window. You would then use that handle to specify the recipient of your instructions.
Reply With Quote
  #3 (permalink)  
Old April 6th, 2007, 03:13 PM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Brian for your reply. I'm sorry but i did not understand what u said. Can u please elaborate with the help of some codes ?
Reply With Quote
  #4 (permalink)  
Old April 6th, 2007, 03:19 PM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In case i have three MDI child forms, then how do i determine the active MDIchild form and use the Master Panel's buttons to control it. Please help, this problem is driving me nuts !
Reply With Quote
  #5 (permalink)  
Old April 6th, 2007, 04:24 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I have 2005, and don't see how to create an MDI app, though I have in the past one so with VB6.

I feel pretty confident that there is a collection of windows, perhaps as part of the Application or App object. Each of the elements in that collection may have an .activated or .focus or .HasFocus property. I'd look around for something like that.

Also I suspect that in the creation of a new child, the functionality has a way to receive a handle to that window at the same time. Perhaps creating the child as a variable:
Code:
    Dim fA_Child As frmOneOfMyForms

    fA_Child = New frmOneOfMyForms
    fA_Child.Show
    or something like that. If you then ran the 2nd and 3rd line a second time, the 1st form would still be open (and you lost your reference to it), and fA_Child is now a reference to a 2nd child.

Having a reference, you then have access to all of the public properties and exposed objects of the form that it is a reference to.

Is that clearer? Perhaps I'll poke around on this a bit at home over the weekend. (I do have a lot other to do...)
Reply With Quote
  #6 (permalink)  
Old April 9th, 2007, 02:04 PM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help Brian !!! But the codes u have provided did not work.
Reply With Quote
  #7 (permalink)  
Old April 10th, 2007, 01:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default


put this code in the MDI form:

Dim activeChild As Form = Me.ActiveMDIChild


"There are two ways to write error-free programs. Only the third one works."
Unknown
Reply With Quote
  #8 (permalink)  
Old April 11th, 2007, 02:38 PM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have used the following code at the Close button in the panel of MDI Parent, it gives me the error as "Use the 'New' keyword to create an object instance".

  Dim activechild As Form = Me.ActiveMdiChild
        If (Not activechild Is Nothing) Then
            MsgBox("No active MDI Child")
        Else
            activechild.Close()
        End If

What shall i do now ?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying MDI Child Form Menus with MDI Parent ashu_from_india Pro VB 6 3 June 10th, 2008 11:01 PM
Setting MDI Parent / Child Kunkel VB.NET 2 March 27th, 2008 05:05 AM
Controlling MDI child form from MDI parent panel LuxCoder Pro Visual Basic 2005 1 May 25th, 2007 12:20 PM
Controlling MDI child form from MDI parent panel LuxCoder VB How-To 1 April 9th, 2007 03:25 PM
Controlling MDI child form from MDI parent panel LuxCoder Visual Basic 2005 Basics 2 April 9th, 2007 03:24 PM



All times are GMT -4. The time now is 03:34 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.