Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27329

VS 2010 How to get Text of Last Items added To ListBox?

$
0
0
I have created a project that showes our forum users online inside a listbox. The list box refreshes every Second, so if a new user is online, then the user is showen in the Listbox.

But how can I get the Name/Text of the "Last" or the "Latest" Joined in Listbox and add the the users name to a textbox!

Now here is an important thing about this, because some times we have 5 Users Joining at the same time, and I want all the latest 5 to show up in 5 different TextBoxes.....

So far I have this code Here, but it showes the FIRST ITEM on TOP ofcourse:
Code:

Dim str as String
str = listbox1.Items(listbox1.Items.Count - 1)
TextBox1.Text  = str

And my other question is, Do I have to add the code in "ListBox1_SelectedIndexChanged" code?
I will be very happy to know how it can be done with at least 1 to 5 users!

Many thanks in Advance..........


Ps, The point with all of this is that I have created another script that sends a Welcome Message to the Users who just Joined. But I am trying to first figure out how to get the Latest Users names befor. Then it will be easier for me to Send the Message.....

Viewing all articles
Browse latest Browse all 27329

Trending Articles