I need help. I want to check if user exists by entering their ic number and I want to display another rest of their data by using file in visual basic. Unfortunately, an error occurs while doing that. I need help. If the user exists, then It will display automatically name, email, address and so on but if a user doesn't exist, then it shows message box. Here I attached the image of the display screen and the code. Please help me. Thank you.
Public Class Form1 Private Sub btnSearch_Click(sender As Object, e As EventArgs) Handles btnSearch.Click Dim userFile As String = "C:\Users\HP\Desktop\userdata.txt" Dim inputFile As String If System.IO.File.Exists(userFile) = True Then Dim objReader As New System.IO.StreamReader(userFile) Dim intIc As Integer Dim intCount As Integer = 0 Dim strName As String Dim strEmail As String Dim intPhoneNum As String Dim strAdd1 As String Dim strAdd2 As String Dim intPostcode As String Dim strState As String Do While objReader.Peek() <> -1 intIc(intCount) = Convert.ToInt64(objReader.ReadLine()) If (intIc(intCount).Convert.ToInt64(objReader.ReadLine())) Then strName(intCount) = objReader.ReadLine() strEmail(intCount) = objReader.ReadLine() intPhoneNum(intCount) = Convert.ToInt32(objReader.ReadLine()) strAdd1(intCount) = objReader.ReadLine() strAdd2(intCount) = objReader.ReadLine() intPostcode(intCount) = Convert.ToInt32(objReader.ReadLine()) strState(intCount) = objReader.ReadLine() lblName.Text = strName lblEmail.Text = strEmail lblNum.Text = intPhoneNum lblAdd1.Text = strAdd1 lblAdd2.Text = strAdd2 lblPostcode.Text = intPostcode lblState.Text = strState objReader.Close() Else MessageBox.Show("User Does Not Exist") End If intCount = intCount + 1 Loop Else MessageBox.Show("File Does Not Exist") End If End Sub End Class