Upgrade (Event order changing)

netpicker9

Member
Joined
Dec 8, 2004
Messages
17
Programming Experience
1-3
Hi,

I have upgraded VB6 to Vb.net 2005.

In VB6 I have a ComboBox for Country List, and Event called "cboCountry_GotFocus".
VB.NET:
Private Sub cboCountry_GotFocus()
If txtAddress.text = "" then
MsgBox "Enter Address First", , App.Title
txtAddress.SetFocus
End if 
End Sub
Above event fires, once combo box got focus.
After conversion, in VB.net its converted as "cboCountry_Enter".
Problem is once form is loaded The code under "cboCountry_Enter" is executing directly.
Which I don't want..
VB.NET:
Private Sub cboCountry_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cboCountry.Enter
If txtAddress.text = "" then
MsgBox "Enter Address First", , App.Title
txtAddress.SetFocus
End if 
End Sub
I tried changing _Enter Event to _GotFocus event, but still same problem.. How to solve this?

Thanks
 
Last edited by a moderator:
the code needs to look like this

VB.NET:
private sub cboCompany_GotFocus(.....) [U]handles cboCompany.gotfocus[/U]
 
...
...
 
 
end sub

that should fix your problem

good luck

regards
adam
 
Back
Top