Solved

'System.NullReferenceException'  error

Posted on 2006-11-05
4
189 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now