Results 1 to 40 of 61

Thread: [RESOLVED] How to write a generic contact List to a file that's inside a List(of contacs)

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2016
    Location
    Tennessee
    Posts
    2,437

    Resolved [RESOLVED] How to write a generic contact List to a file that's inside a List(of contacs)

    Hi everyone. I've been working on things with this type code for a little but, and I only just now wondered how to write out the generic list of contacts inside the List(of contacts). I hope that makes sense. Maybe it will when you see some code. I tried searching on the net, but it doesn't understand what I'm searching for.

    So, here's the declarations.

    Code:
    Public newContact As New Contact()
    Public contacts As New List(Of Contact)()
    I've had a number of people look at my post, but no one has said anything. Maybe it's because I'm not being clear. Here's more code that will hopefully let you see what I am trying to do.

    Code:
     With newContact
                .FirstName = firstName.Text
                .LastName = lastName.Text
                .PhoneNumber = PhoneNumber.Text
                .Birthday = Birthday.Value
                Using sw
                    sw = AppendText(theFilename)
                    sw.Write(.FirstName & "," & .LastName & "," & .PhoneNumber & "," & .Birthday)
                    sw.WriteLine()
                End Using
            End With
    So, newContact is a single class that contains the information associated with the class.
    Contacts is a List of newContact that contains all information for all instances of newContact.

    Disclaimer: I'm NEW at this stuff, so if the above explanation is not correct, I hope you know from the code what's going on cause.... I did my best guys...

    I want to make sure my approach to getting the information is sound, and looks half way good <smile>

    Since I can't get a search on the net to work, I will have to write my own code. Problem is, it would look like such a hack. It would work... just wouldn't want to show it to my friends. I'm pretty sure the logic will be centered around the Contacts count (with the "S" on the end of Contact)

    I'm not exactly looking for someone to give me some pretty code. But if you can let me know a better way to search to find the answers or a link to some site, that would be great.

    Thanks for any help. I do appreciate any help.

    If you need more info, just ask.

    edit: writing to a file is no problem... don't need help there <smile>
    Last edited by jumper77; Apr 16th, 2016 at 09:47 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width