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

  • Thread starter Thread starter Lee Gillie
  • Start date Start date
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.
 
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
 
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.
 
Back
Top