Programmatically Adding Container Controls

Happy New Year! Hopefully I can explain my dilemma accurately. I have a window where I am programmatically adding the same container controls using values stored in an array (one to many). The array is passed to the window from a different window. The container control has a label, a text field, and a checkbox. Based on the status of the checkbox, I enable/disable the text field (which works great). The initial values for all fields are set when the container is created. One, none, or all of the values in the text fields for any of the container controls may be changed/updated.

What I cannot figure out is, how to return the updated values in the text field, for each of the container controls, to the initial window. The array is an array of a class object that has (among other data) Name and Value fields. The Value field is what needs to get updated. The Name field will not change and there will never be duplicates

I am wondering if someone can point me to an example or explain how I return the updated values to the corresponding array in the calling window. I know how to do this where the container control is added at design time using the IDE just not when adding them at run time.

Thanks

Keep an array of those ContainerControl objects as you add them. Then you can run through the array and check each one’s text field.

1 Like

Without an array:
myContainer.myTextField.Text = "ABC"

With an array:
myContainer(1).myTextField.Text = "ABC"

if you create this container controls at runtime you can also use define event xyz and AddHandler RemoveHandler.
if something is changed in this cc you can raise this event and get a info in a registered method which also have the sender argument by default.