Is it possible to dynamically generate event code?
Posted: Thu Aug 22, 2019 9:58 am
Hi folks
I am trying to think through how it would be possible to dynamically generate events for dynamically generated controls.
For example, I would like to have an XML file which has the different options I want to dynamically load into an options page. I have managed to do this and create a Label and a Textbox, I can take input and everything is good. Suppose however, 1 of my options is for a file path. I want to dynamically create a Label and a Textbox, but also a button next to the Text Box which is linked to an FolderBrowserDialog control. The Button needs to have a Click event, that then points to the FolderBrowserDialog and has the necessary code for what to do next.
Is this something that is possible, if so, can someone point me in the right direction for how to approach this, perhaps a blog post or tutorial? Or, If I am getting too carried away and things like this should be statically defined, please let me know!
Thanks!
I am trying to think through how it would be possible to dynamically generate events for dynamically generated controls.
For example, I would like to have an XML file which has the different options I want to dynamically load into an options page. I have managed to do this and create a Label and a Textbox, I can take input and everything is good. Suppose however, 1 of my options is for a file path. I want to dynamically create a Label and a Textbox, but also a button next to the Text Box which is linked to an FolderBrowserDialog control. The Button needs to have a Click event, that then points to the FolderBrowserDialog and has the necessary code for what to do next.
Is this something that is possible, if so, can someone point me in the right direction for how to approach this, perhaps a blog post or tutorial? Or, If I am getting too carried away and things like this should be statically defined, please let me know!
Thanks!