• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 181
  • Last Modified:

Keep Focus On the Specific TextBox

When the user fill the Textbox I want to check his information with the data base if is found I want to tell him Record found before then cancel the lostfocus . Where I can apply this code and how to to that
0
Ahmadal_najjar2003
Asked:
Ahmadal_najjar2003
2 Solutions
 
RobinSoftware EngineerCommented:
In VB6, you can use the Textbox' Validate event.

e.g.:
The function CheckedInDatabase() should check the information in the database, and return True when ok,
and False when not ok.
Private Sub Text1_Validate(Cancel As Boolean)
    'check in database    
    If Not CheckedInDatabase(Text1.Text) Then
        Call MsgBox("Sorry, not found in database")
        Cancel = True
    End If
End Sub

Open in new window

0
 
Éric MoreauSenior .Net ConsultantCommented:
Be sure to set the CausesValidation to False on your Cancel or Exit button otherwise the user won't be even able to close the form.
0
 
Ahmadal_najjar2003Author Commented:
Thanks A lot
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now