By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,033 Members | 1,290 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,033 IT Pros & Developers. It's quick & easy.

Passing a String Array in a Function

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

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

"Roshawn" <ud****@bellsouth.net> wrote in message
news:ub**************@TK2MSFTNGP14.phx.gbl...
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

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.