Question Populating combobox with class names

shruts

Member
Joined
Sep 13, 2011
Messages
7
Programming Experience
1-3
Dear All,

I have the following class structure

Public Class Controller

Public Class Pos
<Fields>
End Class

Public class Spd
<Fields>
End Class

End Class


I want to create a combobox that displays the classes inside my controller class. Is using reflection the right way to go ahead? Because I have lots of fields and properties inside Pos and Spd classes that I need to display on my form as textbox and it depends on the user selection.

Thanks!!
 
Reflection would be the way to go. Once you have a Type object for your Controller class you can call GetNestedTypes to get a Type array that can be bound to your ComboBox. You can then call GetProperties on the SelectedItem to get a PropertyInfo array that can also be bound if desired.
 
Back
Top