I have a ultracomboeditor with a style set to dropdownlist. Its bound to an arraylist. I need to progamatically set its text to a string thats one of the items in the dropdownlist.
Is there a simple one line of code that does this? I hate to write a loop for this.
Hello,
I have the same kind of issue with the UltraOptionSet bound to the values of an enum (using Enum.GetValues()). The number of radio buttons created is correct (so I can tell that the binding is done) but there is no text displayed.
Johnrambo, can you tell me how you have added the text programmatically. With the UltraOptionSet, a BindableValueList is created and I can't change its behaviour. I will help me wait for the final answer!
thanks
ksossouv said:I have the same kind of issue with the UltraOptionSet bound to the values of an enum (using Enum.GetValues()).
Hm. This doesn't really seem related to the original issue at all. But anyway, I just tried this code and it worked fine for me:
BorderStyle[] borderStyles = Enum.GetValues(typeof(BorderStyle)) as BorderStyle[];this.ultraOptionSet1.DataSource = borderStyles;
If this is not working, then perhaps you are using an older version of the controls. I think there were some issues in the past in the way the binding code dealt with lists of Enums.
I tried something like this:
ctlTypes is a ultracomboeditor with style set to dropdownlist
''populate dropdownlistctlTypes.Items.Add("A", "A")ctlTypes.Items.Add("B", "B")ctlTypes.Items.Add("C", "C")ctlTypes.Items.Add("D", "D")
''set text on ctltypesMe.ctlTypes.SelectedText = "C"
The above line gives me an error about the object not being in EditMode. so I set AlwaysInEditmode to True
and now its giving me an error:
Editor does not support selectable text
I was also thinking that I could just do a for loop on the ctltypes items and compare with the text I need to select. I think that will work but I am just wondering why this line doesnt work: Me.ctlTypes.SelectedText = "C"
As I said above, you need to set the Text property. Not SelectedText. SelectedText is the text that is highlighted by the user in the edit portion of the control and it has no meaning in the DropDownList style.
thanks that did the trick