You can do the Enter and Leave as was suggested in the other box, or you can just use the LostFocus event.
If I were writing something similar to what you were describing, I would expect it to look something like this:
Private Sub Controls_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles TextBox1.LostFocus, TextBox2.LostFocus, ComboBox1.LostFocus
Using dbConn As New OleDb.OleDbConnection("some connection string")
Dim cmd As New OleDb.OleDbCommand("SELECT * FROM Table WHERE User=? ")
cmd.Parameters.Add(userName)
Select Case CType(sender, Control).Name
Case TextBox1.Name
cmd.CommandText = cmd.CommandText & "TextBox1Attribute=?"
cmd.Parameters.Add(TextBox1.Text)
Case TextBox2.Name
cmd.CommandText = cmd.CommandText & "TextBox2Attribute=?"
cmd.Parameters.Add(TextBox2.Text)
Case ComboBox1.Name
cmd.CommandText = cmd.CommandText & "ComboBox1Attribute=?"
cmd.Parameters.Add(ComboBox1.Text)
End Select
If Not IsDBNull(cmd.ExecuteScalar) Then
End If
End Using
End Sub
[E.F. noted a problem. I actually started with:
If TypeOf sender Is TextBox Then
CType(sender, TextBox)...
End If
and changed it because I needed to include ComboBoxes as well and didn't change the CType line.