Click here to Skip to main content
15,908,444 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i use reflection in forms to get attributes, text, name etc of controls i created at runtime ?
Posted
Updated 14-Jul-10 20:48pm
v2

Test the type of the control
Test the name of the control
Based on the type of control then get the content you are after

If C.typeof(textbox)
content = C.Text
 
Share this answer
 
Try using the Controls collection. You can use ForEach(Control C in this .controls)

Then you can test the controls types and get their names etc.
 
Share this answer
 
Comments
SuperAdministrator 15-Jul-10 3:16am    
Yes this worked but the problem is. if its a textbox i need txtboxname.Text or comboBox then i need comboBoxName.selectedItem etc. i know i have the name now and the type but how to get the actual input from the control ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900