Add ValueChanged event handler AFTER control is initialized

G

Guest

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
 
I

Ignacio Machin \( .NET/ C# MVP \)

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,
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top