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! :)

Problem with Combobox and SelectedValue
ptlsra
I think the value changed event is not fired, because the selectedvalue should be set then to the right value, isn't it
MikeBennett
Marinus
Scott Elliott
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)
Michael Henderson
try to make use of:
LostFocusControl
Occurs when the control loses focus.
and
eSPiYa
rgidbig
could be... I have not tried it before... but since he is using autocomplete, it can be trigered either by valuechanged or keypress
MagellanTX
I took that event of ComboBox from the online MSDN. I think you found an mistake in it, too
QIO
It's a bug in Beta2
Craig Oliver
Marinus
dvboom
I use this code in the "Leave" event. I don't find "LostFocusControl " in the ComboBox.
Now works fine... thanks... but... i think this is a bug... ! :)
Dim index As Integer
index = MyComboBox.FindString(MyComboBoxComboBox.Text)
MyComboBoxComboBox.SelectedIndex = index
WillyNT
Hi,
You need to add this line;
combobox1.SelectedValue = combobox1.Text

in the aprpriate events. I think most apropriate would be valuechanged
Good luck