473,568 Members | 3,164 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.NullRefe renceException: Object reference not set to an instance
of an object.
at ControlInfoView .Connect.cc1dac 46909c42ab()
at ControlInfoView .Connect.dd3392 f59d8e3f48(Obje ct e0292b9ed559da7 d,
EventArgs fbf34718e704c6b c)
at System.Windows. Forms.Control.O nResize(EventAr gs e)
at System.Windows. Forms.Form.OnRe size(EventArgs e)
at System.Windows. Forms.Control.O nSizeChanged(Ev entArgs e)
at System.Windows. Forms.Control.U pdateBounds(Int 32 x, Int32 y, Int32
width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows. Forms.Control.U pdateBounds()
at System.Windows. Forms.Control.W mMove(Message& m)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
at System.Windows. Forms.Container Control.WndProc (Message& m)
at System.Windows. Forms.Form.WndP roc(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.Design.De signerWindowTar get.DefWndProc( Message&
m)
at System.Windows. Forms.Design.Co ntrolDesigner.D efWndProc(Messa ge& m)
at System.Windows. Forms.Design.Co ntrolDesigner.W ndProc(Message& m)
at System.Windows. Forms.Design.Pa rentControlDesi gner.WndProc(Me ssage&
m)
at System.Windows. Forms.Design.Sc rollableControl Designer.WndPro c(Message&
m)
at System.Windows. Forms.Design.Do cumentDesigner. WndProc(Message & m)
at System.Windows. Forms.Design.Fo rmDocumentDesig ner.WndProc(Mes sage&
m)
at System.Windows. Forms.Design.De signerWindowTar get.OnMessage(M essage&
m)
Nov 20 '05 #1
2 2203
* je*****@mindspr ing.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.windo wsforms>

--
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*****@mindsp ring.com> wrote in message
news:d3******** *************** **@posting.goog le.com...
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.NullRefe renceException: Object reference not set to an instance
of an object.
at ControlInfoView .Connect.cc1dac 46909c42ab()
at ControlInfoView .Connect.dd3392 f59d8e3f48(Obje ct e0292b9ed559da7 d,
EventArgs fbf34718e704c6b c)
at System.Windows. Forms.Control.O nResize(EventAr gs e)
at System.Windows. Forms.Form.OnRe size(EventArgs e)
at System.Windows. Forms.Control.O nSizeChanged(Ev entArgs e)
at System.Windows. Forms.Control.U pdateBounds(Int 32 x, Int32 y, Int32
width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows. Forms.Control.U pdateBounds()
at System.Windows. Forms.Control.W mMove(Message& m)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
at System.Windows. Forms.Container Control.WndProc (Message& m)
at System.Windows. Forms.Form.WndP roc(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.Design.De signerWindowTar get.DefWndProc( Message&
m)
at System.Windows. Forms.Design.Co ntrolDesigner.D efWndProc(Messa ge& m)
at System.Windows. Forms.Design.Co ntrolDesigner.W ndProc(Message& m)
at System.Windows. Forms.Design.Pa rentControlDesi gner.WndProc(Me ssage&
m)
at System.Windows. Forms.Design.Sc rollableControl Designer.WndPro c(Message&
m)
at System.Windows. Forms.Design.Do cumentDesigner. WndProc(Message & m)
at System.Windows. Forms.Design.Fo rmDocumentDesig ner.WndProc(Mes sage&
m)
at System.Windows. Forms.Design.De signerWindowTar get.OnMessage(M essage&
m)

Nov 20 '05 #3

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

Similar topics

2
10532
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 Error in '/Cr_Dataset' Application. ----------------------------------------------------------- ---------------------
7
1920
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. This object reference is passed into another object create within the same
11
9223
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 C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
7
8092
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: private void Page_Load(object sender, System.EventArgs e) { // load content XslTransform trans = new XslTransform();
2
4118
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 from Stephen K. Young, which does the job: >In message <ahjurk$t18vo$1@ID-65843.news.dfncis.de>, Stephen K. Young ><s@k.y.invalid> writes >Using...
3
4203
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 that needs the class module I get an error on web site: Object reference not set to an instance of an object Here is where the error is:
2
4156
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 can the problem be? This is the complet error message: Server Error in '/MailListManager' Application....
3
8085
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) Handles btnLogin.Click If txtUserID.Text = "" Then txtUserID.Focus() Exit Sub End If If...
42
510
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. " I know WHY it's happening. It is when a selection is not made to a RadioButtonList, so the item is = to nothing.
0
7601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7913
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7659
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6274
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2099
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 we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.