how to handle a change on a runtime combobox value to enable the OKbutton
-
Hi, I have created a number of form for user input, as they are more or the same I created a routine that creates the form in runtime (adding all the controls at runtime). What I now want to do is to have the save button to get enabled as soon as one of the controls has been changed. As I don't have the controls on the form during design time I am having problems using a eventhandler, basically I don't know how. So what I am asking is how do I create an eventhandler, or something else, in the controls I am adding that trigger an event on the form so that I can enable the Save button. Any pointers would be much appreciated. DJ Think, try, think, think, try, think, think, think, try, ASK, think, try, advance on step and start over...
-
Hi, I have created a number of form for user input, as they are more or the same I created a routine that creates the form in runtime (adding all the controls at runtime). What I now want to do is to have the save button to get enabled as soon as one of the controls has been changed. As I don't have the controls on the form during design time I am having problems using a eventhandler, basically I don't know how. So what I am asking is how do I create an eventhandler, or something else, in the controls I am adding that trigger an event on the form so that I can enable the Save button. Any pointers would be much appreciated. DJ Think, try, think, think, try, think, think, think, try, ASK, think, try, advance on step and start over...
Well, you did not specify VB6 or VB.NET, so I will not give much detail. Basically the approach is: VB6 - you have to already have a placeholder control of every type you want add at runtime and add then as a control array. So you just write a single handler and enable the the save button when anyone changes. Or you could process each control in a different way if you know in advance what their array indexes will be. VB.NET Create event handlers and add them to the dynamic controls using the syntax: AddHandler AddressOf Robert