I’m passing a reference of a form to a class. Within this class I believed I could use formRef->Controls['controlName'] to access properties on the control.
This works for a few labels, but on a button I receive a ‘Object reference not set to an instance of an object.’ when I try to change the Text property.
Help or explanation appreciated…
I did this, and it’s working. Could possibly be safer as I can check if the control actually exists…
I think the reason it breaks is that the button is on another panel. I didn’t think of that when I posted. The new solution will search all children too, so it’s an improvement.