Re: Doubts with returning Arraylist...



Figured out... tks..

For i As Integer = 0 To arr.Count - 1

TextBox1.Text &= DirectCast(arr(i), Pets).Animal & " - " &
DirectCast(arr(i), Pets).PetColor & vbCrLf

Next

"Christiano Donke" <cdonke@xxxxxxxxxxxxxxxxxx> escreveu na mensagem
news:eDvQwFoOJHA.4372@xxxxxxxxxxxxxxxxxxxxxxx
Hey there...

I'm having this problem...: When I receive an array of arraylists, how do
I split it???

In the following example, how could I retrive the PetsKind and PetsColor
into Strings variables????

Tks in advance,
Christiano


Here's an sample code....
The arraylist would be populated like this:
Dim arr As ArrayList = New ArrayList

arr.Add(New Pets("dog", "blakc"))
arr.Add(New Pets("dog", "yellow"))
arr.Add(New Pets("dog", "white"))
arr.Add(New Pets("dog", "gray"))

arr.Add(New Pets("cat", "black"))
arr.Add(New Pets("cat", "yellow"))
arr.Add(New Pets("cat", "white"))
arr.Add(New Pets("cat", "gray"))



Public Structure Pets
Private _PetKind As String
Private _PetColor As String

Public Property Animal() As String
Get
Return _PetKind
End Get
Set(ByVal value As String)
_PetKind = value
End Set
End Property

Public Property PetColor() As String
Get
Return _PetColor
End Get
Set(ByVal value As String)
_PetColor = value
End Set
End Property

Public Sub New(ByVal Pet As String, ByVal Color As String)
_PetKind = Pet
_PetColor = Color
End Sub
End Structure



.



Relevant Pages

  • Doubts with returning Arraylist...
    ... When I receive an array of arraylists, ... Private _PetColor As String ... Public Property PetColor() As String ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: ArrayList....how create it?help me....
    ... The other rows have the same format that is string double double double ... I have to store this file as it is. ... Don't do any parsing, don't create arraylists, or anything like that. ... some sort of complicated conversion. ...
    (comp.lang.java.programmer)
  • Searching ArrayList of Classes
    ... I've got arraylists of simple classes bound to controls. ... Private myCipDisplay As String ... Public ReadOnly Property CipDisplay() As String ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Help ArrayLis wont store, and how to remove duplicates????
    ... Splitis a very simplistic method. ... It can split on a single character, ... string manipulation methods and/or Regex. ... though in my experience it does do so with arrays and ArrayLists. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ArrayList Question
    ... albeit one with the wrong type (should have been string not ... "C# doesn't support named indexers; and if it did, ... then Foo foo = new Foo; ... Unfortunately I have three of the arrayLists in this class, ...
    (microsoft.public.dotnet.languages.csharp)

Loading