Main Page | Report Page

 

  .NET DotNet Forum Index » VB.NET Forum (Visual Basic .NET) » Problem with arraylist

Author Message
nondos
Posted: Fri Jun 22, 2007 12:50 pm
 
I have problem with arraylist the object i get from the array is always the
last i'll give example:

Public Class Form1

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

Dim array As New ArrayList

Dim classs As New Class1

Dim i As Integer

For i = 1 To 50

classs.a = i

classs.b = i + 1

classs.c = i + 2

array.Add(classs)

Next

For i = 0 To array.Count - 1

Dim test = array.Item(i)

Next

End Sub

End Class

Public Class Class1

Public a As Integer

Public b As Integer

Public c As Integer

End Class

in this example u can see the var' test will always be with 3 var` a,b,c
that their value equel to 50,51,52

any idea?
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Fri May 06, 2016 3:40 pm