How can I delete the control events at runtime?

G

Giò

I at all.
I have written a simple application where I can drag and drop controls
(standard and custom) from toolbox in a form, move object and set property
as backcolor, forecolore etc...
When i drag the control from the toolbox to the destination form, I create
the new object with reflection (CreateInstance method), and add the control
to the controlcollection of the form. ( with all Your events )
So any control can raise all your events...
This is my problem!
I would want to delete the events from the controls ( only in my form
destination) so that they could not be raises..
How can I do?

I would reall appreciate your help.

Thanks in advance
(sorry for my bat English)
Giò
 
C

Cor

Hi Giò

Today given as a solution by OHM

RemoveHandler ListBox1.SelectedIndexChanged, AddressOf
ListBox1_SelectedIndexChanged
ListBox1.DataSource = tab
ListBox1.DisplayMember = tab.Columns(0).ToString()
ListBox1.ValueMember = tab.Columns(0).ToString()
AddHandler ListBox1.SelectedIndexChanged, AddressOf
ListBox1_SelectedIndexChanged
I hope this helps,

Cor
 

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