PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
How to edit of text in ComboBox WITHOUT loosing track of SelectedItem?
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
How to edit of text in ComboBox WITHOUT loosing track of SelectedItem?
![]() |
How to edit of text in ComboBox WITHOUT loosing track of SelectedItem? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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. |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 "Lee Gillie" wrote: > 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. > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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. Jason L Lind wrote: > 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 > > "Lee Gillie" wrote: > > >>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. >> |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

