I need a simple combo dropdown with two columns.
I have the data in an array and I am trying to get it into the ultracombo.
What is the best way to do this?
If you have the data in an array of objects and the two fields you want to display are public properties on those objects, then the easiest thing to do is to just set your UltraCombo's DataSource to the array.
If that doesn't work because the properties aren't public or the array does not contain objects, then I'd recommend that you copy the data into an UltraDataSource component and use that as the DataSource of your combo.
Mike,
I did move the data into a datasource. That worked.
I have several combos on this form.
I want to pre-select one of the values in each combo so the user doesn't have to choose it. It is a default selection of sorts. I am unable to find information of how to do that. I have tried the combo.value and that doesn't work the way I need. I thought I could use SelectedRow, but not able to figure out how to make it work for me.
Also, I have a data file that holds some of the preset information. I built a two column combo that has the month# and month name in it. The ValueMember is set to the Month Name. If the data file says that the preset is supposed to be "03", then what is the best way to set the combo to default to the third row of the combo (03 | March)? Is there a way to use the "03" as an index to the combo row?
Thanks,
Duane
There is nothing wrong with setting the Value property. I must have had something else set wrong somewhere because I did set the Value property to '3', but I didn't see 'March' in the display (I saw '3'). I read another users forum entry that had the same issue, but it was never addressed.
The ValueMember is now the Month Number and the DisplayMember is now the Month Name and it is working the way I needed it to (the user can type the first letter of the month or the program can initialize the combo using the month number).
It is a long story with the combo boxes, but this one is working correctly now thanks to your tips.
I appreciate the help.
You just have to set the Value property on the Combo. What's wrong with that? What do you mean it "doesn't work like you need?"
KDuaneS said:Also, I have a data file that holds some of the preset information. I built a two column combo that has the month# and month name in it. The ValueMember is set to the Month Name. If the data file says that the preset is supposed to be "03", then what is the best way to set the combo to default to the third row of the combo (03 | March)? Is there a way to use the "03" as an index to the combo row?
Why are you using the month name as the ValueMember? If you want to store the number and display the name, you should be setting the ValueMember to the Month number and the DisplayMember to the month name. That way you can simply set the Value of the control to the month number or get the Value of the control and it will return the number while displaying the name to the user.