Am working on a project using vb.net and i have connected a database to it. I have an employee table within that and now i want to create a search box in vb.net where by if i type the employee-number of the employee i can get access to his or her details.
hey im also having this similar problem.
Using Ms Access.
I have a table containing names and numbers and i have created the cmd button for search but kind of miss the coding.
I have a connection in my data enviroment and everything else is good except 4 this
This is serious
No one seems to tell us the exact thing
I have coded the following but when i keyin a wrong serviuce no., the search box nolonger accepts even the true entries and all the fields go blank
You might wanna try this jolly if it will work for you. You only need to edit in between the lines..
Here my code:
Private Sub cmdSearch_Click()
Dim Mloop As Integer
Dim found As String
'Input service Number to search
Mloop = 0
found = InputBox("Enter Service Number", "Search")
If found = "" Then
DataEnvironment1.rsdepartments.MoveFirst 'Move the pointer to the first record
Do While Mloop = 0
If txtLno = found Then 'if search found display an alert message
MsgBox "Record found"
If DataEnvironment1.rsdepartments.EOF Then 'if search not found display an error message
MsgBox "Enter a VALID Service Number", vbCritical, "Find"
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...