Solved

'System.NullReferenceException'  error

Posted on 2006-11-05
4
192 Views
Last Modified: 2010-04-23
Hi folks,

   I am developing a vb.net application. I have rather a frustrating error that occurs and I can not seem to prevent or cure it. It does not matter what form I may executing etc - it has no pattern as to when it occurs.
Here is the error message:
"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."

And it always takes me back to the main.vb form which contains this codiing. It always highlights the code line of:Application.Run(frmmdiparent)

Module main
    Public Sub Main()
        Dim frmmdiparent As New frmMainMenu
        'shows the splash screen
        Dim frmMainSplash As New frmMainSplash
        frmMainSplash.lblCopyright.Text = "Copyright" & "©2005 All Rights Reserved"          
        frmMainSplash.Show()
        Application.DoEvents()
        frmMainSplash.Hide()
        Application.Run(frmmdiparent)
    End Sub
End Module

any help appreciated -
0
Comment
Question by:bearpaws
  • 2
4 Comments
 
LVL 19

Assisted Solution

by:VoteyDisciple
VoteyDisciple earned 100 total points
ID: 17876569
Yeah, I've noticed Visual Studio isn't too bright when it comes to debugging exceptions within threads.  One thing you might try is throwing a Try..Catch around code in frmmdiparent to at least narrow the error down to somewhere more specific so you at least won't be looking blindly anymroe.
0
 
LVL 34

Accepted Solution

by:
Sancler earned 400 total points
ID: 17876588
An alternative approach to identifying the code that is actually causing the problem - less coding, although it doesn't always work - is (temporarily) to alter your project's properties so that frmMainMenu is its start form.

Roger
0
 

Author Comment

by:bearpaws
ID: 17876622
Good idea - I will try it and see what happens - I will return...
0
 

Author Comment

by:bearpaws
ID: 17876731
Another good idea! I will try that also!
more later and thanks you guys :-)
I am sure this can be resolved.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question