system.NullReferenceException

  • Thread starter Thread starter stephenbugdenlondon
  • Start date Start date
S

stephenbugdenlondon

Hi,

When running the following code:

'************************************************
Dim ColorDB As New ColorDialog()
ColorDB.ShowDialog(Me)
'************************************************

I sometimes (roughly half of the time) get the following
error:

************************************************
An unhandled exception occurred of
type 'system.NullReferenceException' occurred in
system.drawing.dll

Additional information: Object reference not set to an
instance of an object.
************************************************

Some of the time the color dialog is displayed, but then
the error occurs when a color is selected.
Other times it works fine. The statement is withing a try
catch statement.

I have 1.0.3705 of the .net framework and I've installed
service pack 2 and version 7.0.9466 of the development
environment.

Any suggestions greatly appreciated.

Steve.
 
Hi,

You can try making a small a simple program that reproduces the bug on your
PC and then ask your friends or colleagues to run it on their PCs. If the
bug only occurs on your computer, it's most likely there's something wrong
with your system. If the bug reproduces on their computers as well, then you
can either contact Microsoft support, or (rather in addition) publish the
repro in the Windows Forms or Drawing newsgroup in a hope that someone from
Microsoft will pick it up and suggest a workaround.
 
Thanks for the reply. I tried to reproduce the problem in
another project with just the lines of code mentioned but
couldn't.

I did once install (a couple of years ago) the beta
version of visual studio. I then found there was no clear
deinstallation procedure. I did deistall the beta by
following a an article I found (can't remember which one).

Does anyone know if this could cause the problem? If so
what I should do to correct it?

Regards,

Steve.
-----Original Message-----
Hi,

You can try making a small a simple program that reproduces the bug on your
PC and then ask your friends or colleagues to run it on their PCs. If the
bug only occurs on your computer, it's most likely there's something wrong
with your system. If the bug reproduces on their computers as well, then you
can either contact Microsoft support, or (rather in addition) publish the
repro in the Windows Forms or Drawing newsgroup in a hope that someone from
Microsoft will pick it up and suggest a workaround.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"(e-mail address removed)"
 
Back
Top