Link to home
Start Free TrialLog in
Avatar of mglace390
mglace390

asked on

Cursor stuck in Combobox

I have a combobox on a windows form.  The combobox is not a required field so it can be left blank.  However, when the user focuses on the combobox, it will not release the cursor and allow the user to select any of the other controls on the page until they select an item from the dropdown menu.  Is this by design?  If so, it stinks and I need a way around it.  Any help is gratefully appreciated.

Matt
Avatar of tzxie2000
tzxie2000
Flag of China image

how about add a blank as an item into the combobox
you can see many similar design in internet
Avatar of mglace390
mglace390

ASKER

That is a possible solution however it sounds like a workaround to me.  Is this a bug?  Why is the same thing not happening to the other combo boxes on the form?  Could it have to do with the way it is populated?  The combo I populate using the DataSource property acts as it should and the combo that is causing the error above is populated using the AddRange method.
do you use databinding?
whether the combobox binding value is not allow null value?
I do use databinding and I bind the SelectedItem to a string column of a datatable.  The column I'm binding to is nillable therefore I should be able to leave the combobox blank.  Is this what you are referring to?
I solved the problem by taking out the databinding all together.  I simply set the combo box's SelectedItem property to the value of the field in the DataRow in the constructor and vise versa in the form closing event.  Works exactly how I want it to.  Thank you for your help anyway.

Matt
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial