Invalidate

  • Thread starter Thread starter RS
  • Start date Start date
R

RS

if i want to invalidate the client area of my Windows.Form
and execute an overrided OnPaint i would use
Form1.ActiveForm.Invalidate() ?? However, when i use this
line of code i receive a :

An unhandled exception of type
'System.NullReferenceException' occurred in OCRTicker.exe

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

How do you invalidate the client area of a Windows.Form ?

TIA RS
 
Hi there,

I presume it is not in an MDI scenario? Have you tried just calling Invalidate? (Me.Invalidate).

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
 
RS said:
if i want to invalidate the client area of my Windows.Form
and execute an overrided OnPaint i would use
Form1.ActiveForm.Invalidate() ?? However, when i use this
line of code i receive a :

An unhandled exception of type
'System.NullReferenceException' occurred in OCRTicker.exe

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

How do you invalidate the client area of a Windows.Form ?

Call it's Invalidate method. I don't know where you store the reference.
When you get this exception, the reference is not set to an instance of an
object, i.e. it is Nothing. In the case mentioned above, either Form1, or
ActiveForm is Nothing. See the docs for Activeform to find out why.
In the Form itself, simply call Me.Invalidate, or just Invalidate.
 
It worked, Thank you
if i want to invalidate the client area of my Windows.Form
and execute an overrided OnPaint i would use
Form1.ActiveForm.Invalidate() ?? However, when i use this
line of code i receive a :

An unhandled exception of type
'System.NullReferenceException' occurred in OCRTicker.exe

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

How do you invalidate the client area of a Windows.Form ?

TIA RS
 
Back
Top