I am writing a program that will ask the user to add in some of his details, which are stored into a text file, how do i check to see if the email he entered is not already stored in the text file already?
I am also having problems with the Error checking it trying up error when i click save
Imports System.IO
Public Class SecondForm
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
'closing program
Me.Close()
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
'clearing Text boxes
txtFirst.Clear()
txtLast.Clear()
txtAddress.Clear()
txtAddress2.Clear()
txtCard.Clear()
txtMail.Clear()
txtphone.Clear()
txtPassword.Clear()
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
'Declare an object variable
Dim Accountfile As StreamWriter
'This procedure reads data about Account from a file.
Dim strFirst As String
Dim strLast As String
Dim intTelephone As Integer
Dim strMail As String
Dim strAddress As String
Dim strAddress2 As String
Dim intCredit As Integer
Dim strPassword As String
Dim iIn As Integer
'Getting the File name off the User
strFirst = txtFirst.Text
strLast = txtLast.Text
strMail = txtMail.Text
strAddress = txtAddress.Text
strAddress2 = txtAddress2.Text
intTelephone = txtphone.Text
intCredit = txtCard.Text
strPassword = txtPassword.Text
'Open the Data File
Accountfile = File.AppendText("Account.txt")
'Write to the file
Accountfile.WriteLine(strFirst)
Accountfile.WriteLine(strLast)
Accountfile.WriteLine(strMail)
Accountfile.WriteLine(strAddress)
Accountfile.WriteLine(strAddress2)
Accountfile.WriteLine(intTelephone)
Accountfile.WriteLine(intCredit)
Accountfile.WriteLine(strPassword)
'Error Checking on if Number is Entered
If IsNumeric(txtCard.Text) Then
iIn = CInt(txtCard.Text)
If iIn < 14 Then
MsgBox("Credit Card Number Not Vaild, Please Enter 14 digit number")
Else
MsgBox(iIn)
End If
Else
MsgBox("Not a Number")
End If
If IsNumeric(txtphone.Text) Then
iIn = CInt(txtphone.Text)
If iIn < 0 Then
MsgBox("Number not Vaild")
Else
MsgBox(iIn)
End If
Else
MsgBox("Not a Number")
End If
'Close the Account File
Accountfile.Close()
End Sub
End Class