I need to make an address book that doesnt use a database.
It suppose to have
First name
Last name
Birthday
Telephone number
Address (street)
Address (city, state, zip)
Email address
All information shall be stored in a structure at run time
The application should read and write to a data file
Make sure the application includes previous, next, add, save, and delete buttons.
When graded by your instructor, there should be at least five entries in the address book

But the book doesnt show me how to do it and the only online stuff I can find is threw databases and nothing else. I asked the teacher and he says no database for this one, the idea is to use flat files (txt) and I have no idea how to even really start this one. This is what I have so far, only thing ive done was code the buttons and text boxes, then after thaat im lost, could someone help me

Public Class Form1

    Private Sub txtfirst_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtfirst.TextChanged

    End Sub

    Private Sub txtlast_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtlast.TextChanged

    End Sub

    Private Sub txtbirthday_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtbirthday.TextChanged

    End Sub

    Private Sub txtnumber_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtnumber.TextChanged

    End Sub

    Private Sub txtstreet_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtstreet.TextChanged

    End Sub

    Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged

    End Sub

    Private Sub txtcity_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcity.TextChanged

    End Sub

    Private Sub txtstate_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtstate.TextChanged

    End Sub

    Private Sub txtzip_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtzip.TextChanged

    End Sub

    Private Sub txtemail_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtemail.TextChanged

    End Sub

    Private Sub lblprevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblprevious.Click

    End Sub

    Private Sub lblnext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblnext.Click

    End Sub

    Private Sub lbladd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbladd.Click

    End Sub

    Private Sub lblsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblsave.Click

    End Sub

    Private Sub lbldelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbldelete.Click

    End Sub
End Class

Recommended Answers

All 5 Replies

this is the code you have ?


but i can't see any code

See if this helps to get you started with your entries.

Public Class Form1
    Private myAddressBookEntries As New ArrayList '// store your entries.  ArrayList is similar to a ListBox.
    Private arEntry() As String '// String Array to split each entry.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '// add item for testing to ArrayList.
        '//--- separate entry items by a char. like ~ or >, etc., which is used to split that item into separate arrays.
        myAddressBookEntries.Add("first name~last name~address~phone~etc.")
        arEntry = myAddressBookEntries(0).ToString.Split("~"c) '// .Split First item into arrays by using  your char..
        '//--- Second item would be: myAddressBookEntries(1)
        '// display result.
        MsgBox(arEntry(0) & vbNewLine & arEntry(1) & vbNewLine & arEntry(2) & vbNewLine & arEntry(3) & vbNewLine & arEntry(4))
    End Sub
End Class

Then simply save to/load from a .txt file.

Unless you show some effort for this project, I will not bother to further help.
.Reason is that this is probably the third project I have offered to help with and you were still not able to figure out how to change text in a Label by Project 2. I will offer help to those that bother to learn, but will not do each and every assignment for someone.

One more thing, please do not use web space just to use web space.
By posting just one of the controls events code should let us know that you have not done anything other than name a few controls.

commented: Nice addition. +6

I got a turtioral for this assignment and he was in the same class as me and hes now in the advanced part, he had the same assignment as this one last year and he was helping me out on it, well I got confused on a couple parts on what to do it, so I talked to my teacher and showed him the code and he said the code was way to much and to advanced for a beginner, I think while he was tutoring me he teaching me some of the advance codes and putting it into it. The teacher said mainly what your suppose to do is see all your text boxes all at once and then fill them out and then hit save and itll save them all, not one by one and I was trying to fix this, but every time I do, theres always an error, that comes up. I think all I have to do is erase the visible true and false things and it should fix it, but everytime I do it, it keeps coming up with errors

I would go and try and get some more help from the tutrior but hes out of state for a week, family emergency, can someone help me figure out how I can erase the code that only allows one text to come up at once and put all the text to show up at once.

Also when I sometimes load the code back up and try to click one of the saved files, its doesn’t bring any information up, could this be because I closed the code and didn’t have it properly saved or something. And also I need to make a next and previous button for where the saved parts are, but I don’t know how to do this. Heres what I got

Imports System
Imports System.IO
Public Class Form1

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        check()
        Initial()
    End Sub
    Private Sub check()

        'check dir exists Ph1,Ph2,Ph3

        Dim path As String
        Dim temp As String


        path = CurDir()
        path = path + "\ph1\"
        temp = Directory.Exists(path)
        If temp = False Then
            Directory.CreateDirectory(path)
        End If

        path = CurDir()
        path = path + "\ph2\"
        temp = Directory.Exists(path)
        If temp = False Then
            Directory.CreateDirectory(path)
        End If

        path = CurDir()
        path = path + "\ph3\"
        temp = Directory.Exists(path)
        If temp = False Then
            Directory.CreateDirectory(path)
        End If


    End Sub
    Private Sub Initial()


        Button1.Text = "EXIT"


        Button2.Text = "Add"
        Button3.Text = "EDIT"
        Button4.Text = "Cancel"
        Button5.Text = "SAVE"
        Button6.Text = "DELETE"
        Button7.Text = "ENTER"
        Button7.Visible = False




        RadioButton1.Text = "Family and friends"

        If RadioButton1.Checked = False And RadioButton2.Checked = False And RadioButton3.Checked = False Then
            RadioButton1.Checked = True
        End If

        RadioButton2.Text = "Contacts"
        RadioButton3.Text = "Other"


        Button2.Visible = True
        Button3.Visible = False
        Button4.Visible = False
        Button5.Visible = False
        Button6.Visible = False


        TextBox1.Visible = False
        TextBox2.Visible = False
        TextBox3.Visible = False
        TextBox4.Visible = False
        TextBox5.Visible = False
        TextBox6.Visible = False


        Label6.Text = ""
        Label7.Text = "city, state, zip code:"

        Label1.Visible = False
        Label2.Visible = False
        Label3.Visible = False
        Label4.Visible = False
        Label5.Visible = False
        Label6.Visible = True
        Label7.Visible = False


        Label12.Visible = False
        Label13.Visible = False
        Label14.Visible = False



        fill_listbox()

        ListBox1.Visible = True
        GroupBox1.Visible = True



    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Form1.Visible = True
        Close()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'Add

        Label1.Text = "Name"
        Label2.Text = "Address"
        Label3.Text = "Phone"
        Label4.Text = "birthday"
        Label5.Text = "E-Mail"
        Label6.Text = ""

        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        TextBox6.Text = ""

        TextBox1.Visible = True
        TextBox2.Visible = False
        TextBox3.Visible = False
        TextBox4.Visible = False
        TextBox5.Visible = False
        TextBox6.Visible = False

        Label1.Visible = True
        Label2.Visible = False
        Label3.Visible = False
        Label4.Visible = False
        Label5.Visible = False
        Label6.Visible = True
        Label7.Visible = False

        Label12.Visible = True
        Label12.Text = "Add"

        Label13.Visible = False

        Label14.Visible = False
        Label14.Text = ""

        Label6.Text = "Note:" + vbCrLf + "Use Tab key to move to next box." + vbCrLf + "or place cursor in next box" + vbCrLf + "Press Space to leave box blank"
        Label6.Text = Label6.Text + vbCrLf + "You cannot leave ""Name"" blank"

        Button2.Visible = False
        Button3.Visible = False
        Button4.Visible = True
        Button5.Visible = False
        Button6.Visible = False
        Button7.Visible = False

        ListBox1.Visible = False
        GroupBox1.Visible = False


    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        'EDIT


        ListBox1.Visible = False
        TextBox1.Visible = True
        TextBox2.Visible = True
        TextBox3.Visible = True
        TextBox4.Visible = True
        TextBox5.Visible = True
        TextBox6.Visible = True

        Label1.Visible = True
        Label2.Visible = True
        Label3.Visible = True
        Label4.Visible = True
        Label5.Visible = True
        Label6.Visible = False
        Label7.Visible = True

        Label12.Visible = True
        Label12.Text = "EDIT"
        Label13.Text = "EDIT"
        Label14.Text = ""

        Button2.Visible = False
        Button3.Visible = False
        Button4.Visible = True
        Button5.Visible = True
        Button6.Visible = False
        Button7.Visible = False

        Button5.Text = "SAVE"


        GroupBox1.Visible = False

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        'Cancel

        Initial()


    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        'SAVE

        Dim path As String
        Dim result As String
        Dim temp As String
        Dim group As String = ""

        If RadioButton1.Checked = True Then group = "\ph1\"
        If RadioButton2.Checked = True Then group = "\ph2\"
        If RadioButton3.Checked = True Then group = "\ph3\"


        If Label12.Text = "Add" Then
            If TextBox1.Text = "" Then
                Label14.Text = "No text entered"
            Else
                path = CurDir()
                result = TextBox1.Text
                path = path + group + result + ".txt"
                result = File.Exists(path)

                If result = True Then
                    Label13.Text = "AN ENTRY WITH THAT NAME ALREADY EXISTS"
                    Label13.Visible = True
                    MsgBox("Not Saved")
                    TextBox1.Visible = True
                    TextBox2.Visible = True
                    TextBox3.Visible = True
                    TextBox4.Visible = True
                    TextBox5.Visible = True
                    TextBox6.Visible = True

                    Label1.Visible = True
                    Label2.Visible = True
                    Label3.Visible = True
                    Label4.Visible = True
                    Label5.Visible = True
                    Label6.Visible = False
                    Label7.Visible = True
                Else
                    Label6.Text = "Name:" + TextBox1.Text + vbCrLf + "Address:" + TextBox2.Text + vbCrLf + "Phone:" + TextBox3.Text + vbCrLf + "birthday:" + TextBox4.Text + vbCrLf + "E-mail:" + TextBox5.Text + vbCrLf + "city, state, zip code:" + TextBox6.Text + vbCrLf + "End:"
                    File.WriteAllText(path, Label6.Text)
                    Button5.Text = "SAVED"
                    Label13.Text = ""
                    Initial()
                    fill_listbox()

                End If
            End If
        End If

        If Label12.Text = "EDIT" Then
            path = CurDir()
            result = TextBox1.Text
            path = path + group + result + ".txt"
            Label6.Text = "Name:" + TextBox1.Text + vbCrLf + "Address:" + TextBox2.Text + vbCrLf + "Phone:" + TextBox3.Text + vbCrLf + "birthday:" + TextBox4.Text + vbCrLf + "E-mail:" + TextBox5.Text + vbCrLf + "city, state, zip code:" + TextBox6.Text + vbCrLf + "End:"
            result = File.Exists(path)
            If result = True Then
                File.WriteAllText(path, Label6.Text)
                Button5.Text = "SAVED"
                Initial()
                fill_listbox()
            Else
                Label14.Text = "The name has changed."
                temp = MsgBox("The NAME has changed." + vbCrLf + "Do you want to ""SAVE"" the Add Name as a Add entry?", vbYesNo + vbQuestion)
                If temp = vbYes Then
                    path = CurDir()
                    path = path + group + TextBox1.Text + ".txt"
                    result = File.Exists(path)
                    If result = True Then
                        temp = MsgBox("This name already exists" + vbCrLf + "Do you want to overwrite existing entry?", vbYesNo + vbQuestion)
                        If temp = vbYes Then
                            File.WriteAllText(path, Label6.Text)
                            fill_listbox()
                        Else
                            MsgBox("FILE NOT SAVED")
                        End If
                    Else
                        File.WriteAllText(path, Label6.Text)
                        Button5.Text = "SAVED"
                        Initial()
                        fill_listbox()
                    End If
                End If
            End If
        End If


    End Sub
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        'DELETE

        Dim path As String
        Dim result1 As String
        Dim temp As String
        Dim group As String = ""

        If RadioButton1.Checked = True Then group = "\ph1\"
        If RadioButton2.Checked = True Then group = "\ph2\"
        If RadioButton3.Checked = True Then group = "\ph3\"

        'Listbox item
        path = CurDir()
        path = path + group + ListBox1.SelectedItem + ".txt"
        result1 = File.Exists(path)
        If result1 = True Then
            temp = MsgBox("Are you sure you want to delete the entry for " + vbCrLf + ListBox1.SelectedItem, vbYesNo + vbQuestion)

            If temp = vbYes Then
                Label6.Text = ""
                Label14.Text = ""
                File.Delete(path)
                Button3.Visible = False
                Button4.Visible = False
                Button5.Visible = False
                Button6.Text = "DELETED"
                Button7.Visible = False

                Label12.Text = ""
                Label14.Text = ""

                TextBox1.Text = ""
                TextBox2.Text = ""
                TextBox3.Text = ""
                TextBox4.Text = ""
                TextBox5.Text = ""
                TextBox6.Text = ""

                TextBox1.Visible = False
                TextBox2.Visible = False
                TextBox3.Visible = False
                TextBox4.Visible = False
                TextBox5.Visible = False
                TextBox6.Visible = False

                Label1.Visible = False
                Label2.Visible = False
                Label3.Visible = False
                Label4.Visible = False
                Label5.Visible = False
                Label6.Visible = False
                Label7.Visible = False
                fill_listbox()
            End If
        End If




    End Sub
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        'ENTER

        Button2.Visible = False
        Button5.Text = "SAVE"
        If Label14.Text = "FINISH" Then
            If TextBox3.Text = "" And TextBox4.Text = "" Then
                Label13.Text = "NO PHONE NUMBERS ENTERED"
                Label6.Visible = False
            Else
                Label14.Text = "Press ""SAVE""" + vbCrLf + "to store "
                Button5.Visible = True
                Button7.Visible = False
                Label6.Visible = True
                Label6.Text = "Name:" + TextBox1.Text + vbCrLf + "Address:" + TextBox2.Text + vbCrLf + "Phone:" + TextBox3.Text + vbCrLf + "birthday:" + TextBox4.Text + vbCrLf + "E-mail:" + TextBox5.Text + vbCrLf + "city, state, zip code:" + TextBox6.Text + vbCrLf + "End:"
                TextBox1.Visible = False
                TextBox2.Visible = False
                TextBox3.Visible = False
                TextBox4.Visible = False
                TextBox5.Visible = False
                TextBox6.Visible = False
                Label1.Visible = False
                Label2.Visible = False
                Label3.Visible = False
                Label4.Visible = False
                Label5.Visible = False
                Label7.Visible = False

            End If
        End If

    End Sub
    Private Sub fill_listbox()

        Dim path As String
        Dim result() As String
        Dim temp As String
        Dim L1 As Integer
        Dim L2 As Integer
        Dim L3 As Integer
        Dim group As String = ""
        Dim begin As String
        Dim finish As String
        Dim s As Integer
        Dim f As Integer
        Dim day As String
        Dim n As Integer

        If RadioButton1.Checked = True Then group = "\ph1\"
        If RadioButton2.Checked = True Then group = "\ph2\"
        If RadioButton3.Checked = True Then group = "\ph3\"

        ListBox1.Items.Clear()
        path = CurDir()
        path = path + group

        L1 = Len(path)
        result = Directory.GetFiles(path)
        L1 = L1 + 1          'start next char after the Path

        For c = 0 To UBound(result)
            temp = (result(c))

            'check if a valid entry

            day = File.ReadAllText(temp)
            begin = "Name:"
            finish = "Address:"
            s = InStr(1, day, begin)
            f = InStr(1, day, finish)
            s = s + 5
            n = f - s
            n = n - 2

            If n < 0 Then

            Else
                L2 = Len(temp)
                L2 = L2 - 3          'removes the .txt at end of text
                L3 = L2 - L1         'Gives the filename
                temp = Mid(temp, L1, L3)
                ListBox1.Items.Add(temp)
            End If
        Next

        If ListBox1.Items.Count = 0 Then
            Button6.Visible = False
            Label6.Visible = True
            Label6.Text = "No valid entries found"
        End If

    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        'Name
        Dim path As String
        Dim result As String
        Dim group As String = ""

        If RadioButton1.Checked = True Then group = "\ph1\"
        If RadioButton2.Checked = True Then group = "\ph2\"
        If RadioButton3.Checked = True Then group = "\ph3\"

        If Label12.Text = "Add" Then
            Label13.Visible = False
            path = CurDir()
            result = TextBox1.Text
            path = path + group + result + ".txt"
            result = File.Exists(path)

            TextBox2.Visible = True
            Label6.Visible = False
            Label2.Visible = True

            If result = True Then
                Label13.Visible = True
                Label13.Text = "AN ENTRY WITH THAT NAME ALREADY EXISTS"
                TextBox2.Visible = False
                Label2.Visible = False
            End If
        End If

        Button5.Text = "SAVE"
        Button7.Visible = False

    End Sub

    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
        'Address

        If Label12.Text = "Add" Then
            TextBox1.Text = Trim(TextBox1.Text)
            If TextBox1.Text = "" Then
                Label6.Text = "Enter Name first" + vbCrLf + "Blank space not accepted for Name"
                Label6.Visible = True
                TextBox2.Visible = False
            Else
                Label6.Text = ""
                Label6.Visible = False
                TextBox3.Visible = True
                Label3.Visible = True
                'Label13.Text = "Enter Phone number"
            End If
        End If

        Button5.Text = "SAVE"

    End Sub

    Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
        'home phone number
        If Label12.Text = "Add" Then
            TextBox4.Visible = True
            Label4.Visible = True
            'Label13.Text = "Enter birthday number"
            Label14.Text = "FINISH"
            Button7.Visible = True
        End If
        Button5.Text = "SAVE"
    End Sub

    Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
        'birthday phone number
        If Label12.Text = "Add" Then
            TextBox5.Visible = True
            Label5.Visible = True
        End If
        Button5.Text = "SAVE"
    End Sub

    Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
        'E-Mail
        If Label12.Text = "Add" Then
            TextBox6.Visible = True
            Label7.Visible = True
        End If

        Button5.Text = "SAVE"

    End Sub

    Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
        If Label12.Text = "Add" Then
            If TextBox6.Visible = True Then
                Label14.Visible = True
                Label14.Text = "FINISH"
            End If
            Button7.Visible = True
        End If

        Button5.Text = "SAVE"

    End Sub


    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

        Dim path As String
        Dim n As Integer = 1
        Dim s As Integer = 1
        Dim f As Integer = 0
        Dim begin As String = ""
        Dim finish As String = ""
        Dim temp As String
        Dim day As String
        Dim group As String = ""

        If RadioButton1.Checked = True Then group = "\ph1\"
        If RadioButton2.Checked = True Then group = "\ph2\"
        If RadioButton3.Checked = True Then group = "\ph3\"

        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        TextBox6.Text = ""

        Button3.Visible = True
        Button6.Visible = True

        path = CurDir()
        path = path + group + ListBox1.SelectedItem + ".txt"
        Try
            Label6.Text = File.ReadAllText(path)
            temp = File.ReadAllText(path)
            begin = "Name:"
            finish = "Address:"
            s = InStr(1, temp, begin)
            f = InStr(1, temp, finish)
            s = s + 5
            n = f - s
            n = n - 2
            day = Mid(temp, s, n)
            TextBox1.Text = day
            Label1.Visible = True
            Label1.Text = "Name:"

            begin = "Address:"
            finish = "Phone:"
            s = InStr(1, temp, begin)
            f = InStr(1, temp, finish)
            s = s + 8
            n = f - s
            n = n - 2
            day = Mid(temp, s, n)
            TextBox2.Text = day
            Label2.Visible = True
            Label2.Text = "Address:"

            begin = "Phone:"
            finish = "birthday:"
            s = InStr(1, temp, begin)
            f = InStr(1, temp, finish)
            s = s + 6
            n = f - s
            n = n - 2
            day = Mid(temp, s, n)
            TextBox3.Text = day
            Label3.Visible = True
            Label3.Text = "Phone"

            begin = "birthday:"
            finish = "E-mail:"
            s = InStr(1, temp, begin)
            f = InStr(1, temp, finish)
            s = s + 7
            n = f - s
            n = n - 2
            day = Mid(temp, s, n)
            TextBox4.Text = day
            Label4.Visible = True
            Label4.Text = "birthday"

            begin = "E-mail:"
            finish = "city, state, zip code:"
            s = InStr(1, temp, begin)
            f = InStr(1, temp, finish)
            s = s + 7
            n = f - s
            n = n - 2
            day = Mid(temp, s, n)
            TextBox5.Text = day
            Label5.Visible = True
            Label5.Text = "E-Mail"

            begin = "city, state, zip code:"
            finish = "End:"
            s = InStr(1, temp, begin)

            f = InStr(1, temp, finish)
            s = s + 6
            n = f - s
            n = n - 2

            day = Mid(temp, s, n)
            TextBox6.Text = day
            Label7.Visible = True
            Label7.Text = "city, state, zip code"

            Label14.Text = TextBox1.Text + vbCrLf + TextBox3.Text + vbCrLf + TextBox4.Text

        Catch ex As Exception
            Label6.Text = "No Entry selected"
            Button2.Visible = True
            Button3.Visible = False
            Button6.Visible = False
            Label14.Text = ""
        End Try


        TextBox1.Visible = False
        TextBox2.Visible = False
        TextBox3.Visible = False
        TextBox4.Visible = False
        TextBox5.Visible = False
        TextBox6.Visible = False

        Label1.Visible = False
        Label2.Visible = False
        Label3.Visible = False
        Label4.Visible = False
        Label5.Visible = False
        Label6.Visible = True
        Label7.Visible = False
        Label12.Visible = False
        Label13.Visible = False
        Label14.Visible = True

        Button2.Visible = True
        Button4.Visible = False
        Button5.Visible = False
        Button6.Text = "DELETE"
        Button7.Visible = False

    End Sub


    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

    End Sub

    Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click

    End Sub

    Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click

    End Sub

    Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.Click

    End Sub

    Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click

    End Sub

    Private Sub Label7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label7.Click

    End Sub

    Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Label12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label12.Click

    End Sub

    Private Sub Label13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label13.Click

    End Sub

    Private Sub Label14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label14.Click

    End Sub

    
    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged

        TextBox1.Visible = False
        TextBox2.Visible = False
        TextBox3.Visible = False
        TextBox4.Visible = False
        TextBox5.Visible = False
        TextBox6.Visible = False

        Label1.Visible = False
        Label2.Visible = False
        Label3.Visible = False
        Label4.Visible = False
        Label5.Visible = False
        Label6.Visible = True
        Label7.Visible = False
        Label12.Visible = False
        Label13.Visible = False
        Label14.Visible = True

        Label6.Text = ""
        Label14.Text = ""

        Button2.Visible = True
        Button3.Visible = False
        Button4.Visible = False
        Button5.Visible = False
        Button6.Visible = False
        Button7.Visible = False
        fill_listbox()
        ListBox1.Visible = True
    End Sub
    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        TextBox1.Visible = False
        TextBox2.Visible = False
        TextBox3.Visible = False
        TextBox4.Visible = False
        TextBox5.Visible = False
        TextBox6.Visible = False

        Label1.Visible = False
        Label2.Visible = False
        Label3.Visible = False
        Label4.Visible = False
        Label5.Visible = False
        Label6.Visible = True
        Label7.Visible = False
        Label12.Visible = False
        Label13.Visible = False
        Label14.Visible = True
        Label6.Text = ""
        Label14.Text = ""

        Button2.Visible = True
        Button3.Visible = False
        Button4.Visible = False
        Button5.Visible = False
        Button6.Visible = False
        Button7.Visible = False
        fill_listbox()
        ListBox1.Visible = True
    End Sub

    Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
        TextBox1.Visible = False
        TextBox2.Visible = False
        TextBox3.Visible = False
        TextBox4.Visible = False
        TextBox5.Visible = False
        TextBox6.Visible = False

        Label1.Visible = False
        Label2.Visible = False
        Label3.Visible = False
        Label4.Visible = False
        Label5.Visible = False
        Label6.Visible = True
        Label7.Visible = False
        Label12.Visible = False
        Label13.Visible = False
        Label14.Visible = True
        Label6.Text = ""
        Label14.Text = ""

        Button2.Visible = True
        Button3.Visible = False
        Button4.Visible = False
        Button5.Visible = False
        Button6.Visible = False
        Button7.Visible = False
        fill_listbox()
        ListBox1.Visible = True
    End Sub

    Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter

    End Sub
End Class

Over 800 lines of code to do what? Make it look like you've been busy programming to get no results? :D

You should try and give it a shot with the code I have previously posted.
.It's fairly easy to use.

myAddressBookEntries.Add(TextBox1.Text & "~" & TextBox2.Text & "~" & TextBox3.Text & "~" & TextBox4.Text)

That should add info as one item in the ArrayList.

To add items to the myAddressBookEntries ArrayList, use the code provided in my post to add items to it.

To save, use a For/Next loop.
All you have to do is:

Dim sTemp As String = "" '// add each item from ArrayList as a line.
        For Each myCoolEntry As String In myAddressBookEntries '// loop thru all items.
            If Not sTemp = "" Then sTemp &= vbNewLine & myCoolEntry Else sTemp = myCoolEntry '// add items to string.
        Next
        IO.File.WriteAllText("C:\test.txt", sTemp) '// save File.

When loading the file, read all lines and add the file lines to the ArrayList.

To get the values of each item, use the code provided in my post that .Splits the ArrayList items.

For btnPrevious/btnNext, use something like:

Private myIndexLocation As Integer = 0 '// keep track of location in the ArrayList.
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox(myAddressBookEntries.Item(myIndexLocation))
        myIndexLocation += 1 '// set for next entry to view.
    End Sub

If you want to use a ListBox to display all the contacts name, load the ArrayList first on startup, .Split each item to only get the first and last name, and add only that to the ListBox.
.Clicking an item in the ListBox, should link to the ArrayList by the Index of item.

MsgBox(myAddressBookEntries.Item(ListBox1.SelectedIndex))

the code I put in was junk and I threw it out, so I looked at codeorder's code and it helped me out, thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.