By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,166 Members | 1,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,166 IT Pros & Developers. It's quick & easy.

Invalidate

P: n/a
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

Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Nak
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
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #2

P: n/a
"RS" <rl*****@worldnet.att.net> schrieb
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.

--
Armin

Nov 20 '05 #3

P: n/a
RS
It worked, Thank you
"RS" <rl*****@worldnet.att.net> wrote in message news:OM**************@TK2MSFTNGP12.phx.gbl...
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

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.