Question Disposed event


New member
Oct 26, 2020
Programming Experience
I was trying to keep track of a lot of TextBoxes, and using the .Handle seemed the obvious choice...
And when the form closes it fires the textbox_Disposed(sender as object, e as eventargs) event the expected number of times (i.e. the number of textboxes), so far so good... BUT the sender.Handle is not the one for the textbox - it is just a "random" value - well i'm sure it points to something, but not any textbox i knew about.

Any ideas? I'm guessing by the time it calls the disposed event the texbox no longer exists.
I would assume that Disposed is raised after the disposal occurs and the main part of that disposal is the release of the Handle. You could just put the TextBox objects themselves in a List and identify them via the sender.

Latest posts