|
-
Oct 17th, 2008, 06:56 AM
#1
Thread Starter
Lively Member
[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
-
Oct 17th, 2008, 07:02 AM
#2
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.
-
Oct 17th, 2008, 07:26 AM
#3
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))
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|