hi there. i'm the most dangerous kind on here, enough knowledge to tackle a big project, but self taught and not 100% professional standard lol.... need help.
i have a bunch of dynamically created buttons of a custom class I have created. let's call it "customButton". it inherits all button functionality and just adds a bunch of custom properties which arent relevant here.
i want to create a sub that when called, will look at the form, find all instances of the customButton class, and destroy them.
however, using code i've researched online, it doesn;t see the custom class at all which is strange. I have something like this :
for i as integer = me.controls.count - 1 to 0 step -1
dim ctrl = me.controls(i)
if typeof (ctrl) is customButton then
ctrl.dispose()
end if
next
this doesn't do a thing. BUT**** if I change it to if typeof (ctrl) is Button then it successfully removes all buttons (dont want to do that of course but it's helpful to prove the code's ok)
so what it seems to me is that the class i created doesn't work with typeof. Is there something I've omitted in the class definition maybe that would say "this class is known as : "
? i just assumed its typeof would be the class name?
i have a bunch of dynamically created buttons of a custom class I have created. let's call it "customButton". it inherits all button functionality and just adds a bunch of custom properties which arent relevant here.
i want to create a sub that when called, will look at the form, find all instances of the customButton class, and destroy them.
however, using code i've researched online, it doesn;t see the custom class at all which is strange. I have something like this :
for i as integer = me.controls.count - 1 to 0 step -1
dim ctrl = me.controls(i)
if typeof (ctrl) is customButton then
ctrl.dispose()
end if
next
this doesn't do a thing. BUT**** if I change it to if typeof (ctrl) is Button then it successfully removes all buttons (dont want to do that of course but it's helpful to prove the code's ok)
so what it seems to me is that the class i created doesn't work with typeof. Is there something I've omitted in the class definition maybe that would say "this class is known as : "
? i just assumed its typeof would be the class name?