Passing arrays

huhhuhhuh

Active member
Joined
Feb 28, 2006
Messages
42
Programming Experience
Beginner
How can i pass arrays to a class? I tried passing it to my global class but seem to have a problem assigning it to a property.
 
The property have to be array type.
VB.NET:
Sub testing()
  Dim strs() As String = {"a", "b", "c"}
  Dim t As New testclass
  t.test = strs
  MsgBox(t.test(2))
End Sub
 
Public Class testclass
  Private _test() As String
  Public Property test() As String()
    Get
      Return Me._test
    End Get
    Set(ByVal value As String())
      Me._test = value
    End Set
  End Property
End Class
 
Thanks, that did the trick. I never thought you could specify an array using String() as I always Dim xxx() As String.
 
Back
Top