Wrox Programmer Forums
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 29th, 2004, 05:00 PM
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Mdi Non-Child Form Question

Hi everybody,

I've got a program that needs to pop-up a few non-child forms the moment the MDIform loads. So I'd expect to just write a sub which opens a non-child form like this:

Private Sub MakeNonChild()
Dim FormX As Form
FormX = New Form
FormX.Owner = Me
FormX.Show()
End Sub

And then call that function in the Load event of the MDIform.
The strange thing is the form pops up allright, but it's completely disabled and I can't get it enabled in any way.
I then proceeded to make a button on my MDIform which also calls the MakeNonChild method and if I use that, it works perfectly.

Does anyone have any suggestions as to why it goes wrong in the load event?

Thx in advance!
 
Old December 30th, 2004, 06:49 AM
Authorized User
 
Join Date: Dec 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello GeneralDisorder,

All of the events which occur when a form is loaded have not completed when the "Load" event is being executed. However, by the time the command button becomes visible, the MDI form's "Activate" event has executed. Suggest you place a Msgbox statement in each of the MDI form's event handlers to see in what order they are firing. You have probably interrupted the normal sequence by using the code which calls MakeNonChild().

Dude
 
Old December 30th, 2004, 08:25 AM
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Dude,

I can't put the code in the activate event since I don't want new forms popping up each time the window is activated. I've placed messageboxes in the activated and load events and it seems that the activated event is called before the load event. There's no other event than the form load that's appropriate, I think. If you know any other events to use, I'd greatly appreciate it.

Greetz
 
Old December 30th, 2004, 07:10 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I suspect it belongs to a modal process (guessing).

What if you set a ShowForm Boolean in the Load event, and then, in the Activate event

If ShowForm Then
    ShowForm = False
    MakeNonChild
End If





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
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.NET 2002/2003 Basics 7 April 11th, 2007 02:38 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





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