472,364 Members | 2,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,364 software developers and data experts.

Object Reference Error Before Running The Application

I'm getting an Object Reference error before I even run my app, and
I'm not sure where to look to find the cause. I'd appreciate your
help.

When I open my Windows Application project, the following Microsoft
Development Environment error message displays:

"Object reference not set to an instance of an object."

Then when I access the design view of one of my forms, the controls on
the form are hidden behind an error 'display' showing the text at the
end of this post. When I run the app, it seems to run OK. When I
open other projects, I don't get the error, so I'm guessing it's
caused by something in my app. But it would seem that Debug is of no
help, since the error occurs without running the app, and no error
appears when I run the app.

Interesting additional observation: The problem only occurs when I
open the project to a class or module code window (since it was the
active window when I last closed the project). When I open the
project to a design view of a form, the error doesn't appear. Oh, and
I've also tried reinstalling/repairing Visual Studio, and that hasn't
helped. I'm using VB.NET.

Any suggestions???

Thanks for your help.

- Jeff
Here's the error text displayed on the form:

System.NullReferenceException: Object reference not set to an instance
of an object.
at ControlInfoView.Connect.cc1dac46909c42ab()
at ControlInfoView.Connect.dd3392f59d8e3f48(Object e0292b9ed559da7d,
EventArgs fbf34718e704c6bc)
at System.Windows.Forms.Control.OnResize(EventArgs e)
at System.Windows.Forms.Form.OnResize(EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventAr gs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32
width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds()
at System.Windows.Forms.Control.WmMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.Design.DesignerWindowTarget.D efWndProc(Message&
m)
at System.Windows.Forms.Design.ControlDesigner.DefWnd Proc(Message& m)
at System.Windows.Forms.Design.ControlDesigner.WndPro c(Message& m)
at System.Windows.Forms.Design.ParentControlDesigner. WndProc(Message&
m)
at System.Windows.Forms.Design.ScrollableControlDesig ner.WndProc(Message&
m)
at System.Windows.Forms.Design.DocumentDesigner.WndPr oc(Message& m)
at System.Windows.Forms.Design.FormDocumentDesigner.W ndProc(Message&
m)
at System.Windows.Forms.Design.DesignerWindowTarget.O nMessage(Message&
m)
Nov 20 '05 #1
2 2094
* je*****@mindspring.com (Jeff) scripsit:
I'm getting an Object Reference error before I even run my app, and
I'm not sure where to look to find the cause. I'd appreciate your
help.


Post the question to this group:

<news:microsoft.public.dotnet.framework.windowsfor ms>

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Nov 20 '05 #2
Jeff,
I've found this is usually the result of a declaring a class (but not
initiating it), and refering to it in the Load event of the form,
particularly if it inherits from another form

eg
Public Class Form1
.......

Private m_MyObject as MyObject

Private Sub Form_Load(ByVal sender as Object, ByVal e as EventArgs)
Handles MyBase.Load
'Set the value of MyObject or so something with MyObject
End Sub

The problem can be solved if you initialize MyObject when you declare it ,
ie
Private m_MyObject as New MyObject

(Check base classes and make sure you build the project after making the
changes)

Stephen
"Jeff" <je*****@mindspring.com> wrote in message
news:d3*************************@posting.google.co m...
I'm getting an Object Reference error before I even run my app, and
I'm not sure where to look to find the cause. I'd appreciate your
help.

When I open my Windows Application project, the following Microsoft
Development Environment error message displays:

"Object reference not set to an instance of an object."

Then when I access the design view of one of my forms, the controls on
the form are hidden behind an error 'display' showing the text at the
end of this post. When I run the app, it seems to run OK. When I
open other projects, I don't get the error, so I'm guessing it's
caused by something in my app. But it would seem that Debug is of no
help, since the error occurs without running the app, and no error
appears when I run the app.

Interesting additional observation: The problem only occurs when I
open the project to a class or module code window (since it was the
active window when I last closed the project). When I open the
project to a design view of a form, the error doesn't appear. Oh, and
I've also tried reinstalling/repairing Visual Studio, and that hasn't
helped. I'm using VB.NET.

Any suggestions???

Thanks for your help.

- Jeff
Here's the error text displayed on the form:

System.NullReferenceException: Object reference not set to an instance
of an object.
at ControlInfoView.Connect.cc1dac46909c42ab()
at ControlInfoView.Connect.dd3392f59d8e3f48(Object e0292b9ed559da7d,
EventArgs fbf34718e704c6bc)
at System.Windows.Forms.Control.OnResize(EventArgs e)
at System.Windows.Forms.Form.OnResize(EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventAr gs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32
width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds()
at System.Windows.Forms.Control.WmMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.Design.DesignerWindowTarget.D efWndProc(Message&
m)
at System.Windows.Forms.Design.ControlDesigner.DefWnd Proc(Message& m)
at System.Windows.Forms.Design.ControlDesigner.WndPro c(Message& m)
at System.Windows.Forms.Design.ParentControlDesigner. WndProc(Message&
m)
at System.Windows.Forms.Design.ScrollableControlDesig ner.WndProc(Message&
m)
at System.Windows.Forms.Design.DocumentDesigner.WndPr oc(Message& m)
at System.Windows.Forms.Design.FormDocumentDesigner.W ndProc(Message&
m)
at System.Windows.Forms.Design.DesignerWindowTarget.O nMessage(Message&
m)

Nov 20 '05 #3

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

Similar topics

2
by: Pkpatel | last post by:
Hi, I keep getting this error every time I try to load crystalreportviewer on a webform with a dataset. Here is the error: -------------------------------------------------------- Server...
7
by: Nick Zdunic | last post by:
I have a remotable object running in my host application. The host starts up and creates the object. Within a method to start the remote object doing its thing it creates an object. ...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
7
by: mike p. | last post by:
I have a docbook xml file, and am using standard docbook 1.61.3 xsl stylesheets to do xhtml transform. Transform works fine when using MSXML. When I try to do the following using asp.net 1.1: ...
2
by: Zippy | last post by:
Some months ago, we requested help from this newsgroup on how to replace the library reference of a database with another library reference, prior to creating an MDE. I got the following answer...
3
by: Adam | last post by:
We have a web site that uses .vb for the web pages and .cs for a class module. We are getting the error in .NET 2.0 and VS 2005 beta 2. It does work with .NET 1.1. When trying to access a page...
2
by: Hennie | last post by:
I Get the following error all of a sudden: I do not know what is wrong or where to start looking. I added the Debug="true" directive at the top of the page, but it does not help at all. What...
3
by: red_ghost | last post by:
in my home.aspx page I have a simple login set. when you hit the button it redirects. Here is the code: Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs)...
42
by: dancer | last post by:
Using VB.net and ASP.net At runtime I receive the error that MANY people receive who are using much more complicated code than mine. "Object reference not set to an instance of an object. " ...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

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.