Creating an event handler at runtime

Hey everyone, I have a problem trying to implement a solution which requires changing control properties at runtime based on whether another control’s property is set.

In my program, I read a file containing instructions on how to change the control’s properties, and match the data to each of the controls on my form. An example of such a thing is if the file contains something like “LED_A = Switch_B”. So LED_A is a PictureBox control that selects one of two images – an “On” or an “Off” state – based on conditions given on the file I’m reading.

From this condition, Switch_B (a CheckBox) determines when LED_A should be on. So when Switch_B is Checked, LED_A should change its image to the On image. What I’m trying to figure out is how to do this at runtime. I tried using the AddHandler method but it didn’t seem to work.

submitted by /u/norandomtechie
[link] [comments]

Leave a Reply