I have recently started using the UltraComboEditor and have noticed an un-desirable 'bug' of the control.
I initialize the control in the designer as follows:
this.uceDepartmentHeadName.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bdsTop, "DepartmentHeadName", true));
this.uceDepartmentHeadName.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.bdsTop, "DepartmentHeadID", true));
this.uceDepartmentHeadName.DataMember = "ttwDepartmentHead";
this.uceDepartmentHeadName.DataSource = this.pdsFillLists;
this.uceDepartmentHeadName.DisplayMember = "DepartmentHeadName";
this.uceDepartmentHeadName.ValueMember = "DepartmentHeadID";
When I run the program and proceed to change the text of the control by typing something that is NOT in the itemList of the control, the control will NOT give up focus. That is, if I try to click to another control the UltraComboEditor will still have the focus. The only way to reliquinish the focus to another control is to select an item from the UCE's list.
If I remove ONE of the two bindings from the control I do not get this behaviour... Is this a bug? If not, why is it behaving this way and how can I alter this behaviour?
Hello trionah,
Thank you for your feedback and for sharing this with us. We believe that the other community members could benefit from such threads.
Please feel free to let me know if a question about our toolset comes up on your mind.
Try this code :Make one button called CmdBlankButton doess nothing (just for focus only)On Leave Event of UltraComboEditor put this code :
Private Sub cbItem_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbItem.Leave If cbItem.Value = Nothing Or cbItem.Value = "" Then cbItem.LimitToList = False cmdBlankButton.focus() Else cbItem.LimitToList = True End If End Sub
100% percent work, because I also have a same problem with you but I can solve it by trying this solution.
I wish you will be happy
Ahh but I just realized something. It wouldn't make sense for me to bind both if I allow the user to type in text because he cannot type in a value... so I can only bind both when the user is selecting from the list alone. I think this will solve my problem... Thanks for directing me in the right direction.
Thanks for the reply.
I've always bound the Value and Text columns simultaneously of the Microsoft ComboBox and I've never had a problem... Maybe I'm mistaken but I don't see the contradiction.
If I have a table with DepartmentHeadName and DepartmentHeadID I want both these to change, to change one and not the other would not make sense then what is the point of the comboBox?
The ComboBox has a Text and a Value. The Text is what the user sees and the Value is hidden (same as my DataTable the DepartmentHeadID is useless to the end user so we hide it)... but if the user Changes to a different list item I would want both the DepartmentHeadName to change as well as the ID. If we only bound the Value and not the Text it would not make much sense.
This is how the Microsoft version of the ComboBox was meant to be used, but please correct me if I'm using this control incorrectly.
Thanks for the reply, but the LimitToList is already set to false.