How to edit of text in ComboBox WITHOUT loosing track of SelectedItem?

L

Lee Gillie

Is there some way to allow editing of the text in the ComboBox WITHOUT
loosing track of SelectedItem?

A class keeps a set of related text items together which I represent
visually with a set of text boxes, and one ComboBox, which helps
navigate the list of items in an ArrayList. An ArrayList, bound to the
ComboBox holds a collection of instances of this class. On
SelectedItemChanged I get the current class instance and paint the text
boxes. As text boxes are edited, the data is updated in the ArrayList item.

But when I go to edit the text in the ComboBox, visually it works.
However, in the TextChanged event for the ComboBox I see the
SelectedItem goes to nothing apparently because the text has changed.
Therefore any further edits on this item are lost.

DropDownStyle is DropDown.
 
G

Guest

You need to actually change the text on the class being bound to the
dropdrown, rebind it, and select the appropriate item.

Hope that helps,

Jason Lind
 
L

Lee Gillie

Yes, it was beginning to look that way to me. I appreciate your
responding, and confirming this for me. I could not find an unnoticable
and graceful way to do this, so I am going to disallow the CB edit for
the moment. It is an unusual approach I guess.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top