Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/07/2010, 07:36
berthus
 
Fecha de Ingreso: octubre-2006
Mensajes: 68
Antigüedad: 17 años, 6 meses
Puntos: 0
Arrays de objetos

Tengo un Array de un objeto y cuando hago un bucle de la array todos los valores del array se me igualan

Public class miClass

Private Shared ArrayPruebal(0) As Prueba

public shared sub ()
dim contador as integer
contador=0
For Each MiDataRow As System.Data.DataRow In miTabla.Rows
ArrayPruebal(contador)= new Prueba(MiDataRow.Item("id").ToString())
contador=contador+1
redim preserve ArrayPruebal(contador)
next

end sub


al depurar lo veo

Primera ronda
ArrayPruebal (0) = Objeto 1
Segunda ronda
ArrayPruebal (0) = Objeto 2
ArrayPruebal (1) = Objeto 2

Tercera ronda
ArrayPruebal (0) = Objeto 3
ArrayPruebal (1) = Objeto 3
ArrayPruebal (3) = Objeto 3
.....


gracias por la ayuda

Albert







End Class