Problem with Combobox and SelectedValue
Hi again from Spain.
I'm working with the beta2 (VB.NET) and i have a problem with a ComboBox and the SelectedValue propertie.
I fill a Combo from a database and i use the AutoComplete feature to make easy select a value.
But... if i use TAB to enter the Combo... i type the value or select it with the keyboard... and ... then use the TAB to go to the next control (or click with the mouse in other field, button, etc)... the SELECTEDVALUE of this combo is NULL.
In the combo appear the text of the value... but i need to select it with the mouse or press ENTER to assing the value to the SELECTEDVALUE propertie of the Combo.
Sorry if my english is not very good... :(
Any solution?
A very BIG thanks! :)
Hi,
You need to add this line;
combobox1.SelectedValue = combobox1.Text
in the aprpriate events. I think most apropriate would be valuechanged
Good luck 
I just created a new project in Beta2. Dropped a Combobox, filled in some items. set AutoCompleteMode to Append and the source to ListItems. Added som textboxes to enable tabbing. And it just works fine. So there is some other option that you are setting and I don't.
Marinus
Hi,
let's first learn what is combobox. this is consider with using textbox, button and listbox right.
lostfocus event is not a bug, but it is not handle easily so programer face some kind of problems.
you have some knoledage about Overriding. This concept will solve your problem if your will foucs lost with using Tab key but if you focus lost with using mouse click than parallarly you have to handles a mouse click event for all componet except combo.
about both combination will 100% solve you problems.
1)protected overrides processcmdkey(.....)
in body of the methods you will handle Tab and Enter key event and pick value from combobox to any variable as well as you want.
end sub
2)private sub control_MouseClick(byval sender as object, byval e as system.eventargs) _
handles a1.mouseclick, b1.mouseclick, c1.mouseclick, etc
in body of the routine you will handle Tab and Enter key event and pick value from combobox to any variable as well as you want.
end sub
sender Rajat Solanki, (rajatsolanki@yahoo.com)