473,503 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stumped

Hello:

I have an MDI application. When the user selects File/Exit, the following
code executes:

Do While Me.MdiChildren.Length > 0
Me.MdiChildren(0).Close()
Loop
End

This code executes fine. Until I click on Help/About that opens a dialog
box. When I close the About dialox box and then click on File/Exit, I get the
exception:

An unhandled exception of type 'System.NullReferenceException' occurred in
Unknown Module.

Additional information: Object reference not set to an instance of an object.

When I break, it says "There is no source code available for the current
location.

There's no MDI child window open.

Can somebody enlighten me on this?

Venkat
Nov 21 '05 #1
5 905
Try checking to see if Me.MdiChildren is Nothing before the loop. The
length statement might break it?

That's just a guess
Nov 21 '05 #2
Benny:

I removed all the code. Now the clicked event has only "End".

The same behavior still exists!

"Benny Raymond" wrote:
Try checking to see if Me.MdiChildren is Nothing before the loop. The
length statement might break it?

That's just a guess

Nov 21 '05 #3
Try adding a breakpoint right before you call your End...

Which.. you *really* shouldn't call End...

"vvenk" <vv***@discussions.microsoft.com> wrote in message
news:A0**********************************@microsof t.com...
Hello:

I have an MDI application. When the user selects File/Exit, the following
code executes:

Do While Me.MdiChildren.Length > 0
Me.MdiChildren(0).Close()
Loop
End

This code executes fine. Until I click on Help/About that opens a dialog
box. When I close the About dialox box and then click on File/Exit, I get the exception:

An unhandled exception of type 'System.NullReferenceException' occurred in
Unknown Module.

Additional information: Object reference not set to an instance of an object.
When I break, it says "There is no source code available for the current
location.

There's no MDI child window open.

Can somebody enlighten me on this?

Venkat

Nov 21 '05 #4
CJ:

I changed the clicked event to:
Try
End
Catch ex As Exception
MsgBox(ex.Message)
End Try

But even this does not catch the exception. Strangely, there is another
modal window that I open and the application exits fine!

Venki
"CJ Taylor" wrote:
Try adding a breakpoint right before you call your End...

Which.. you *really* shouldn't call End...

"vvenk" <vv***@discussions.microsoft.com> wrote in message
news:A0**********************************@microsof t.com...
Hello:

I have an MDI application. When the user selects File/Exit, the following
code executes:

Do While Me.MdiChildren.Length > 0
Me.MdiChildren(0).Close()
Loop
End

This code executes fine. Until I click on Help/About that opens a dialog
box. When I close the About dialox box and then click on File/Exit, I get

the
exception:

An unhandled exception of type 'System.NullReferenceException' occurred in
Unknown Module.

Additional information: Object reference not set to an instance of an

object.

When I break, it says "There is no source code available for the current
location.

There's no MDI child window open.

Can somebody enlighten me on this?

Venkat


Nov 21 '05 #5
Hi,

Try this code instead:
Dim child As Form

For Each child In Me.MdiChildren

child.Close()

Next

Application.Exit

HTH,

Bernie Yaeger

"vvenk" <vv***@discussions.microsoft.com> wrote in message
news:A0**********************************@microsof t.com...
Hello:

I have an MDI application. When the user selects File/Exit, the following
code executes:

Do While Me.MdiChildren.Length > 0
Me.MdiChildren(0).Close()
Loop
End

This code executes fine. Until I click on Help/About that opens a dialog
box. When I close the About dialox box and then click on File/Exit, I get
the
exception:

An unhandled exception of type 'System.NullReferenceException' occurred in
Unknown Module.

Additional information: Object reference not set to an instance of an
object.

When I break, it says "There is no source code available for the current
location.

There's no MDI child window open.

Can somebody enlighten me on this?

Venkat

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
3155
by: Manny | last post by:
I have a web form "Page1.asp" and it reads data from a database, does some calculations, and displays the records in pages. Works fine. I have a button that displays on the page, defined as...
1
10027
by: Sharron | last post by:
This problem has me completely stumped...everyone on the net seems to have this problem but I don't understand what they are talking about. I know my code is correct it compiles fine but when I try...
0
3044
by: Sharron | last post by:
Hello, This problem has me completely stumped...everyone on the net seems to have this problem but I don't understand what they are talking about. I know my code is correct it compiles fine but...
3
6848
by: Chris | last post by:
I have yet to understand or get a response on the issue I'm having. I'm taking an asp web application and migrating it from Windows 2K to 2003. I have the new website location (2003) settings...
1
1236
by: Kent Wolf | last post by:
I have some code that worked just fine in Access 97 with Word 97 in Windows NT 4.0. We upgraded one of our OS's to Windows XP. Now, the code won't work. I got an error that said something...
5
1347
by: darrel | last post by:
I'm still a bit stumped on how to load a usercontrol, and then pass a property value (or variable value) to it. Here's what I'm using to load the UC: localCUstomControl.ascx.vb...
0
1229
by: Vince Campanile | last post by:
Ive got what must bea very basic question, but its got ne thouroughly stumped. Im writing a very simple application in Visual Basic.Ne 2003, thats using a data adapter hooked up to an Access...
8
3909
by: Gary | last post by:
I'm using an Act database. I was stuck on this a year ago and am still having trouble. I have three bits of code like so : - act.CActAppObj objACT = new act.CActAppObj(); act.CAIBaseView...
3
1248
by: Randy Magruder | last post by:
Hi all, I hope someone here can diagnose what I'm seeing because I'm stumped. I have an asp.net 1.1 application with a login page. I have loaded up the Page_Load( ) with trace messages and...
1
1517
by: slamtart | last post by:
Hi everyone, Stumped for awhile with this one. Not sure what to do next. Basically, I have a laptop computer which I use for work. Prior to around May of this year, there's no trick to...
0
7204
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7342
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5586
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1516
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.