Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keeping Track of Multiple Things (Alternative to an Array)
#1
I thought that some of you may find this useful, It is the List object in VB.NET, which allows you to hold several things in one object. For example, if you have several strings.

[code2=vbnet]Dim str1 As String = "Hello"
Dim str2 As String = "My"
Dim str3 As String = "Name"
Dim str4 As String = "Is"
Dim str5 As String = "Brandon"
Dim strList As List(Of String)
strList.Add(str1)
strList.Add(str2)
strList.Add(str3)
strList.Add(str4)
strList.Add(str5)

Dim total As String = ""
For Each item In strList
total = total + " " + item
Next
Msgbox(total)[/code2]
This code will print out a MessageBox with the text of "Hello My Name Is Brandon "

Obviously this is not the best use for Lists, but they may come in handy when doing something else, so be sure to play around with them!
My Blog | My Setup | My Videos | Have a wonderful day.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using the WebClient Class To Track Download Progress brandonio21 0 6,747 08-23-2013, 01:12 PM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)