Hi,
I have moved a fairly large project from VS2003 to VS2005, and now
trying to get it running.
It now compiles OK after minimal changes, but I am now getting a
NullReference Exception on the following line:
if (_Screen.ActiveForm == this)
Both _Screen.ActiveForm and the current form are descendants of
System.Windows.Forms.Form.
This worked perfectly well in VS2003, and I can't see why it won't work
here. _Screen.ActiveForm is null, but I am not trying to access any of
it's members, just check if it is the current form.
Can anybody point me in the right direction?
Thanks.
Paul Cheetham 5 1256
Try swapping to use ReferenceEquals(_Screen.ActiveForm, this)
Paul Cheetham <PA******@dsl.pipex.com> wrote: I have moved a fairly large project from VS2003 to VS2005, and now trying to get it running.
It now compiles OK after minimal changes, but I am now getting a NullReference Exception on the following line:
if (_Screen.ActiveForm == this)
Both _Screen.ActiveForm and the current form are descendants of System.Windows.Forms.Form. This worked perfectly well in VS2003, and I can't see why it won't work here. _Screen.ActiveForm is null, but I am not trying to access any of it's members, just check if it is the current form.
Is _Screen itself null by any chance?
Could you post a short but complete program which demonstrates the
problem?
See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Hi Jon,
_Screen itself is null, so that explains that, It's not getting
initialised as it should.
The problem seems to be that objects are being created in a different
order than they were in VS2003, meaning that not everything is being
initialised properly.
Thanks.
Paul
Jon Skeet [C# MVP] wrote: Paul Cheetham <PA******@dsl.pipex.com> wrote: I have moved a fairly large project from VS2003 to VS2005, and now trying to get it running.
It now compiles OK after minimal changes, but I am now getting a NullReference Exception on the following line:
if (_Screen.ActiveForm == this)
Both _Screen.ActiveForm and the current form are descendants of System.Windows.Forms.Form. This worked perfectly well in VS2003, and I can't see why it won't work here. _Screen.ActiveForm is null, but I am not trying to access any of it's members, just check if it is the current form.
Is _Screen itself null by any chance?
Could you post a short but complete program which demonstrates the problem?
See http://www.pobox.com/~skeet/csharp/complete.html for details of what I mean by that.
Paul Cheetham <PA******@dsl.pipex.com> wrote: _Screen itself is null, so that explains that, It's not getting initialised as it should. The problem seems to be that objects are being created in a different order than they were in VS2003, meaning that not everything is being initialised properly.
Again, could you post the code which demonstrates the problem? Chances
are it's easy to fix.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Hi,
"Paul Cheetham" <PA******@dsl.pipex.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl... Hi Jon,
_Screen itself is null, so that explains that, It's not getting initialised as it should. The problem seems to be that objects are being created in a different order than they were in VS2003, meaning that not everything is being initialised properly.
How are you assigning it? or where
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Larry Re |
last post by:
I've written a small C# app which appears to work perfectly except for the
fact that I get a NullReference exception when I close the form using the
red 'X' in the upper right hand corner of the...
|
by: Tom |
last post by:
Hi,
I built a class project (classproject.dll) and a web
project (webproject.dll). The web project needs to
reference to that class project.
They can compile without error. But, it has...
|
by: yogarajan |
last post by:
hi
i had developed pop3 Account mail view in my web page
but i got error in (System.NullReference Exception: Object reference not set)
NetStrm.Write(szData, 0, szData.Length); - this line
...
|
by: Steve |
last post by:
Hi All
I have a windows forms Application (SAM) in vb.net 2008 using .net framework
V2
One and only one customer out of 30 customers is getting errors daily where
they have to close and...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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,...
|
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...
|
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...
|
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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
| |