Strange Issue with MDI childs and Merged menus.

W

William Stacey

Have a MDI parent with a menu and a MDI child with a menu that gets added to
the parent - nothing fancy. One the parent, there is a menu (file/new) item
that loads and shows a new child. Works fine so far. However, if you click
(file/new) 2 or 3rd times, without actually clicking on the new child first,
I will get: "An unhandled exception of type 'System.NullReferenceException'
occurred in system.windows.forms.dll Additional information: Object
reference not set to an instance of an object."

However, if I click inside the ListView in the first child (I think because
it changes the focus off the menu) then I can continue creating children
without this error. You must *actually click the control as setting the
focus in the code does not stop the problem. This does not happen if I
remove the menu from the child or if I do not start the child as MDI.
Therefore, I am guessing it is an issue with merged menus and/or mdi
children. Anyone run into this before? Is there a way to simulate the
mouse click in code (i.e. not just setting the focus).

--wjs
 
W

William Stacey

Also...Then set the MDIChildForm menu to none and retry. On my system, I
could keep creating new mdichildren until tired. So it would seem, this has
something to do with the child menu or a menu merge issue.
--wjs
 
D

Duke Sun

I can't reproduce the issue on my side. The sample works fine even I create
more than 50 MDI child windows.

My OS is: Windows XP with SP1a and Visual Studio .NET 2003

Best regards,

Duke Sun
Microsoft Online Partner Support
<MCSE/MCDBA/MCSD>

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top