I have a VB class inside which one of the methods accepts an array of forms.
For each form inside the array, I need it to traverse all of the objects, check if they are a specific tyoe (input, label, checkbox, etc.) and get the properties of each object. Then, I want to dump these into a text file in the following format:
Form1 | Label1 | "Enter your name"
“Enter your name” being the caption or text of the form object.
I want to do this to facilitate the translation of an application. Any ideas or thoughts you might have on this?
You have to do a For Each for the form’s .Controls collection. However, note that if a child control of the form has more controls in its own .Controls collection, they won’t be accounted for. You’ll have to make a recursive function in order to traverse the whole parent-child chain of controls to find them all.
Now, for each control, you’ll want to perhaps do a Case statement to check the Type Of for each control. Then cast the control to it’s type and grab the properties.