vb address book coding help
heres my coding so far, if you scroll down to the add button, next, previous record, save record, could you show me what ive done wrong, im really stuck
Public Class Addressbook
Structure Contacts
Dim Fname As String
Dim Surname As String
Dim Address As String
Dim City As String
Dim Postcode As String
Dim Country As String
Dim NextOfKin As String
End Structure
Dim peoplelist(100) As Contacts
Dim Counter As Integer = 0
Dim Recordnumber As Integer = 0
Dim filename As String = "names.txt"
Dim fieldterminator As String = "#"
Private Sub Addressbook_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If My.Computer.FileSystem.FileExists(filename) Then
Dim content As String
content = My.Computer.FileSystem.ReadAllText(filename)
Dim record() As String = content.Split(Environment.NewLine)
For i As Integer = 0 To record.Length - 7
If record(i).Trim <> String.Empty Then
Dim field() As String = record(i).Split(fieldterminator)
peoplelist(i).Fname = field(0).Trim
peoplelist(i).Surname = field(1).Trim
peoplelist(i).Address = field(2).Trim
peoplelist(i).City = field(3).Trim
peoplelist(i).Postcode = field(4).Trim
peoplelist(i).Country = field(5).Trim
peoplelist(i).NextOfKin = field(6).Trim
End If
Next
Recordnumber = record.Length - 2
Else
MsgBox("file" + filename + "does not exist", , "Missing file")
End If
Counter = 0
updatescreen()
End Sub
Private Sub Passcode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Passcode.Click
Securitypasscode.Show()
Me.Hide()
End Sub
Sub savescreen()
peoplelist(Counter).Fname = TextBox1.Text
peoplelist(Counter).Surname = TextBox2.Text
peoplelist(Counter).Address = TextBox3.Text
peoplelist(Counter).City = TextBox4.Text
peoplelist(Counter).Postcode = TextBox5.Text
peoplelist(Counter).Country = TextBox6.Text
peoplelist(Counter).NextOfKin = TextBox7.Text
filename = Counter = 0
nme.Text = Counter + 1 & "of" & Recordnumber + 1
End Sub
Sub updatescreen()
TextBox1.Text = peoplelist(Counter).Fname
TextBox2.Text = peoplelist(Counter).Surname
TextBox3.Text = peoplelist(Counter).Address
TextBox4.Text = peoplelist(Counter).City
TextBox5.Text = peoplelist(Counter).Postcode
TextBox6.Text = peoplelist(Counter).Country
TextBox7.Text = peoplelist(Counter).NextOfKin
filename = Counter = 0
nme.Text = Counter + 1 & "of" & Recordnumber + 1
End Sub
Private Sub First_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles First.Click
savescreen()
Recordnumber = Counter + 1
updatescreen()
End Sub
Private Sub NextRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NextRecord.Click
savescreen()
Recordnumber = Recordnumber + 1
filename = Counter = 0
updatescreen()
End Sub
Private Sub EndNoSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EndNoSave.Click
End
End Sub
Private Sub SaveAndEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveAndEnd.Click
savescreen()
Save.Update()
End
updatescreen()
End Sub
Private Sub Add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Add.Click
savescreen()
If Recordnumber = Recordnumber + 1 Then
filename = False
End If
updatescreen()
End Sub
Private Sub Previous_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Previous.Click
savescreen()
Recordnumber = Recordnumber - 1
filename = Counter = 0
updatescreen()
End Sub
End Class

