Passing a String Array in a Function

  • Thread starter Thread starter Roshawn
  • Start date Start date
R

Roshawn

Hi,

How do you pass a string array in a function? Here is my code:

Private Function GetData(Byval str() as String) as Items
Dim prdt as Product
With Product
.Response = str
End With
Return prdt.Items
End Function

Sub RetrieveData
dim prdt as product = GetData('here is where my trouble starts - how do
it write the string')
'do more processing here
End Sub

Thanks,
Roshawn
 
Hi,

Dim strItems() As String = {"Item 1", "Item 2"}

For Each s As String In GetData(strItems)

Trace.WriteLine(s)

Next



Private Function GetData(ByVal str As String()) As String()

For x As Integer = 0 To str.GetUpperBound(0)

str(x) = str(x) & " Test"

Next

Return str

End Function



Ken

---------------------------

Hi,

How do you pass a string array in a function? Here is my code:

Private Function GetData(Byval str() as String) as Items
Dim prdt as Product
With Product
.Response = str
End With
Return prdt.Items
End Function

Sub RetrieveData
dim prdt as product = GetData('here is where my trouble starts - how do
it write the string')
'do more processing here
End Sub

Thanks,
Roshawn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top