Results 1 to 3 of 3

Thread: [2008] Add item to list?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2007
    Posts
    73

    Thumbs down [2008] Add item to list?

    Hey, I'm a new programmer in VB and I need some help
    My problem is:
    I have a small chat program, that enables users to chat to each other, but I need to store their usernames somehow. I know how to save settings, which is preferably where I want this to be saved to, but I don't know how to make it so that when the first person signs in, their name gets put at number 1, second person at number 2 etc. apart from having a long list of If statements that would take too long and be too slow =)

    So thanks in advance if u can help me

    P.S If you are one of those people that just says "do a search" so that you can just get up your post count, please don't. I have searched but don't exactly know what to look for, so if you could help me do that, it would be great

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2008] Add item to list?

    I take it this all will be done on the server side?
    If you would add each users username to a List(Of String) as they sign in, you will automatically have them placed in the order they sign in.
    If you're looking to use the Settings, create a setting of type System.Collections.Specialized.StringCollection and use it like any other collection.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: [2008] Add item to list?

    here is what atheist is saying. it shows both.

    Code:
            Dim Names As New List(Of String) 'this could be System.Collections.Specialized.StringCollection
    
            Names.Add("Tom")
            Names.Add("Martin")
            Names.Add("Mary")
            Names.Add("James")
            Names.Add("John")
            Names.Add("Lisa")
            Names.Add("Natalie")
            Names.Add("Emily")
            Names.Add("Nathan")
            My.Settings.storeNames = New System.Collections.Specialized.StringCollection
            My.Settings.storeNames.Add("Foo")
            My.Settings.storeNames.AddRange(Names.ToArray)
            Debug.WriteLine(My.Settings.storeNames.Item(0))
            Debug.WriteLine(My.Settings.storeNames.Item(1))
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

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