467,077 Members | 989 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.

Add ValueChanged event handler AFTER control is initialized

I want to add a ValueChanged event handler to a control. If I add the handler
during form construction then the ValueChanged handler gets called when the
control is initialized, and I don't want this. However I cannot find a place
during form initialization where I can add the handler AFTER the control has
been initialized.

So, how do I add a ValueChanged event handler to a control AFTER the control
has been initialized?

- Javaman
Nov 17 '05 #1
  • viewed: 2415
Share:
2 Replies
Hi,

You can do so after InitializateComponents() is called in the constructor.

Additionally you could do so in the Load event of the form.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Javaman59" <Ja*******@discussions.microsoft.com> wrote in message
news:B8**********************************@microsof t.com...
I want to add a ValueChanged event handler to a control. If I add the
handler
during form construction then the ValueChanged handler gets called when
the
control is initialized, and I don't want this. However I cannot find a
place
during form initialization where I can add the handler AFTER the control
has
been initialized.

So, how do I add a ValueChanged event handler to a control AFTER the
control
has been initialized?

- Javaman

Nov 17 '05 #2
Thanks Ignacio,

In testing your solutions I've discovered that the root of my problem was a
programming error on my part. In fact ValueChanged is not normally called for
a control when the form and control are initialized.

Cheers,

Stephen

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

You can do so after InitializateComponents() is called in the constructor.

Additionally you could do so in the Load event of the form.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Javaman59" <Ja*******@discussions.microsoft.com> wrote in message
news:B8**********************************@microsof t.com...
I want to add a ValueChanged event handler to a control. If I add the
handler
during form construction then the ValueChanged handler gets called when
the
control is initialized, and I don't want this. However I cannot find a
place
during form initialization where I can add the handler AFTER the control
has
been initialized.

So, how do I add a ValueChanged event handler to a control AFTER the
control
has been initialized?

- Javaman


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by skhairnar@gmail.com | last post: by
3 posts views Thread by rfinch | last post: by
2 posts views Thread by John Kotuby | last post: by
2 posts views Thread by kpg* | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.