Hi all,
I'm using an UltraComboEditor as an editor in an UltraWinGrid to make a translation "Internal ID" <-> "User Key". The UltraComboEditor has a DataTabe as the DataSource:
ID Key100 1101 2102 3... ....201 100Entering data:DisplayMember ValueMember 1 -> 1002 -> 101 100 -> 100 WRONG201 -> 201 WRONG
What do I have to do the only Values in the key-list are accepted and correctly translated? DisplayMember ValueMember 1 -> 1002 -> 101 100 -> 201201 -> Not accepted
Hi Boris,
I have a satisfying solution now, thank you and Mike!
Manuel
Hello Manuel,
Could you please let me know if you were able to resolve your issue per Mike's suggestions.
Feel free to ask if something comes up.
Hi Mike,
You got it right. I can enter 201 which is not in the DisplayMember column and the UltraComboEditor accepts it as a ValueMember. In my opinion not quite a correct behaviour, but I can hadle this by code. Setting LimitToList doesn't change anything.
Hi Manuel,
masch said:In my example I can enter 201 and it is translated into the pair 100 - 201, displayed is 100.
I'm not sure I am following you. But this might be a problem because of how the control responds when the value you enter does not exist on the list of DisplayMembers.
If you enter something that does not exist in the DisplayMember column, then there is no way for the combo to translate that text into a Value. In such a case, the Value property returns the Text you typed.
So if you type in something that doesn't have a matching DisplayMember value, the Value is set to the whatever you typed. If that value exists on the DataMember list, then there is no way for the control to know that the value came from the text. It's essentially the same as setting the Value to 201.
I suppose you could handle this by setting LimitToList to true and thus preventing the user from typing in anything that doesn't match a DisplayMember.
This helps a lot, nearly perfect!
The only point is, that the UltraComboEditor still looks up in the value-list, if the key entered does not exist in the display-list, but only as a last resort. In my example I can enter 201 and it is translated into the pair 100 - 201, displayed is 100. Entering 100 is correctly translated into 201.I think I can handle this by code. It would be nice if that would not be necesary.
Many thanks!
P.S: The value-list is of type Int, the display-list of type string.