Wilman

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,530
Location
Lansing, MI; USA
Programming Experience
10+
Sorry :) I hit the wrong key and then sent the email without finishing it.
I need more help from you good man.
I have a text file filled with a collection of records:

ID # Full Name Department

544 Wilman Arrollo Grid Casting
797 Luis Ramirez Grid Casting
1016 Randy Barrel Grid Casting
1086 Melvin Sanchez Grid Casting
1029 Chris Carol Grid Casting
I need to search within the file for the ID numbers and check if the ID number exists, and then if it does, I have a msg that will tell the user that the ID numbers exist.
If the ID numbers do not exist then it creates the new record. Now I want to read the ID number, for example ID number 544. If this ID number exists, I need to read the Name that is next to it.
I just need the name to mach the user ID. I can search for the ID number, but it just finds the first record and does not go beyon the first record. This is what I'm doing:


Dim
BCC As StreamReader = File.OpenText(ArchivoP)

RJG = BCC.ReadToEnd

BCC.Close()

Dim Buscar As String = txtIDN.Text

If IsNumeric(Buscar) = True Then

Buscare = CompareMethod.Text

Seleccionar = InStr(RJG, Buscar, Buscare)

If Seleccionar = 1 Then

MsgBox("The ID Number: " & Buscar & " is already exist in the database." & vbCrLf & "Please try a different ID Number", 48, "ID Number Exist In Database")

txtRID.Select(Seleccionar - 1, Buscar.Length)

txtRID.Select()

txtRID.ScrollToCaret()

Return

End If

Call GridCasting()

Else

MsgBox("Invalid entry. Please make sure to enter numbers only, and then try again.", 48, "Invalid Entry")

txtIDN.Focus()

Return

End If

End If

Thank you in advance for your help.

I simply made a quick demo for reading in all the data.
 
Back
Top