Reputation: 232
I'm working on a VB6 project and I cam across something that I'm unable to resolve. In my project I'm using 2.0 comboboxes. Everything works fine, in terms of loading the combobox with data, selecting it, and the whole bunch. What I'm trying to do is, once data has been selected, I'm making sure that the same data has not been selected in both comboboxes. I'm trying to write a quick comparison IF statement in LOST FOCUS for one of the cbo's but it doesn't seem to work.
Private Sub cbo1_LostFocus()
if cbo1.text<>"" and cbo2.text<>"" then
if cbo1.text = cbo2.text then
MSGBOX "Duplicate Values"
else
exit sub
End if
end if
End Sub
it doesn't at all realize there is LOST FOCUS - I don't think I've ever done that to a cbo, usually textboxes and such. Any help is appreciated.
Upvotes: 1
Views: 930
Reputation: 455
You could try GotFocus instead. It seems the LostFoucs event can be overridden or masked in certain cases. This article shows a similar problem: http://www.vbforums.com/showthread.php?396536-RESOLVED-VB6-LostFocus
Of course, you could always upgrade to the latest VB, but I'm guessing you have your reasons.
Upvotes: 1