Getting a NullReferenceException Error when invoking a Select File Dialog Box
Posted
by codingguy3000
on Stack Overflow
See other posts from Stack Overflow
or by codingguy3000
Published on 2010-03-08T20:57:28Z
Indexed on
2010/03/08
21:06 UTC
Read the original article
Hit count: 203
Hey everyone
This is a real newbie question. I have simple app that selects a picture and display's that picture in a PictureBox.
I decided to mess with the Opacity Attribute so I added a timer and created this cool effect where the Main Form's Opacity is increased by 20% every 400 miliseconds.
The problem is that now when I click the button that invokes the Select File Dialog Box I'm getting a NullReferenceException error.
private void tmrClock_Tick(object sender, EventArgs e)
{
if (ViewerForm.ActiveForm.Opacity != 1)
{
ActiveForm.Opacity = ActiveForm.Opacity + .20;
}
}
The error message is pointing to the if statement.
What am I doing wrong?
Thanks
© Stack Overflow or respective owner