467,077 Members | 1,001 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,077 developers. It's quick & easy.

a UserConctrol needs to raise an event when it starts

Often I have a problem like the following:
..

This is the way I think things happen is:
If the usercontrol raises the event when it is first created (I.e., in it's
New, or in it's Enter event, or in it's HandleCreated event...) the Form,
which caused the control's New to run, is itself being created and is not
yet ready to receive an event, so the raised event is lost.

I could put a timer on the control or have the form somehow (via a call to a
sub or property...) cause the event to be raised, but that seems clunky.

Any suggestions?
Thanks
Nov 21 '05 #1
  • viewed: 958
Share:
5 Replies

" Just Me" <gr****@a-znet.com> wrote in message
news:ei**************@TK2MSFTNGP11.phx.gbl...
Often I have a problem like the following:
.

This is the way I think things happen is:
If the usercontrol raises the event when it is first created (I.e., in it's New, or in it's Enter event, or in it's HandleCreated event...) the Form,
which caused the control's New to run, is itself being created and is not
yet ready to receive an event, so the raised event is lost.

I could put a timer on the control or have the form somehow (via a call to a sub or property...) cause the event to be raised, but that seems clunky.

Any suggestions?


Use the PAINT event to raise the event. Set a flag when fired so you don't
fire it on every Paint event
Nov 21 '05 #2
sound good, I'll try it now

Thanks a lot

"Noozer" <do*******@me.here> wrote in message
news:O8**************@TK2MSFTNGP15.phx.gbl...

" Just Me" <gr****@a-znet.com> wrote in message
news:ei**************@TK2MSFTNGP11.phx.gbl...
Often I have a problem like the following:
.

This is the way I think things happen is:
If the usercontrol raises the event when it is first created (I.e., in

it's
New, or in it's Enter event, or in it's HandleCreated event...) the Form,
which caused the control's New to run, is itself being created and is not
yet ready to receive an event, so the raised event is lost.

I could put a timer on the control or have the form somehow (via a call
to

a
sub or property...) cause the event to be raised, but that seems clunky.

Any suggestions?


Use the PAINT event to raise the event. Set a flag when fired so you don't
fire it on every Paint event

Nov 21 '05 #3
work great
thanks
"Noozer" <do*******@me.here> wrote in message
news:O8**************@TK2MSFTNGP15.phx.gbl...

" Just Me" <gr****@a-znet.com> wrote in message
news:ei**************@TK2MSFTNGP11.phx.gbl...
Often I have a problem like the following:
.

This is the way I think things happen is:
If the usercontrol raises the event when it is first created (I.e., in

it's
New, or in it's Enter event, or in it's HandleCreated event...) the Form,
which caused the control's New to run, is itself being created and is not
yet ready to receive an event, so the raised event is lost.

I could put a timer on the control or have the form somehow (via a call
to

a
sub or property...) cause the event to be raised, but that seems clunky.

Any suggestions?


Use the PAINT event to raise the event. Set a flag when fired so you don't
fire it on every Paint event

Nov 21 '05 #4
Just me,

Why are you not just calling in the new sub the event you want to call?

Cor
Nov 21 '05 #5

"Cor Ligthert" <no************@planet.nl> wrote in message
news:eh**************@TK2MSFTNGP12.phx.gbl...
Just me,

Why are you not just calling in the new sub the event you want to call?

Cor

I think you mean:
Why are you not just Raising in the new sub the event you want to raise

If so, as I said in the post - I think the control's New runs before the
form is ready to receive events.

But the first time the control's Paint is raised seems to be late enough so
that it works there (Info from to Noozer).

Thanks

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Vittorio Pavesi | last post: by
1 post views Thread by Jeff Williams | last post: by
3 posts views Thread by =?Utf-8?B?Ulc=?= | last post: by
11 posts views Thread by nadeem_far@yahoo.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.