c# - Using Generic Event Handler for Controls in Windows Forms! -


i have bunch of controls populated database when form loads. using dictionary (control.name key , control.value value) store inital values. when user changes values using other dictionary load current values , compare inital dictionary. if values different running kind of code prompt user of changes. think more hackish , looking better solution. please advise.

thanks

try this

for each ctrl control in me.controls             if typeof ctrl checkbox                 addhandler (directcast(ctrl, checkbox).checkedchanged), addressof control_changed             elseif typeof ctrl textbox                 addhandler (ctrl.textchanged), addressof control_changed             elseif typeof ctrl numericupdown                 addhandler (directcast(ctrl, numericupdown).valuechanged), addressof control_changed             end if          next  sub control_changed(byval sender object, byval e eventargs)         ' handle events here     end sub 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -