alright, i have been banging my head against this for days and i think i must be missing something.
the problem:
I want to be able to list the possible values of a property of a control in a listbox.
for example, lets say I throw it a textbox and the property I want to investigate is the "TextMode" property.
I want the list box to list the possible values of the textbox TextMode possibilites ("SingleLine, MultiLine, Password).
I am using a barcode control and I really don't want to have to write case statements for all 200+ versions of symbology.
here is how far i am now:
this will list all the available propertiesCode:Type type = TextBox1.GetType(); System.Reflection.PropertyInfo[] properties = type.GetProperties(); foreach (System.Reflection.PropertyInfo property in properties) { propertyList.Items.Add(new ListItem(property.Name)); }
and this:will only give me the current value of that property, not the possible values.Code:string propertyName = "TextMode"; System.Reflection.BindingFlags flags = System.Reflection.BindingFlags.GetProperty; System.Reflection.Binder binder = null; object[] args = null; object result = type.InvokeMember(propertyName, flags, binder, TextBox1, args); valueText.Text = result.ToString();
so.. any help?


Reply With Quote
