473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Passing a String Array in a Function

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
1 1199
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Alex Vinokur | last post by:
Various forms of argument passing ================================= C/C++ Performance Tests ======================= Using C/C++ Program Perfometer...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
1
by: Foxy Kav | last post by:
Hi everyone, im a first year UNI student doing a programming subject and im stuck on how to get rid of my global variables, char stringarray and char emptystring. I was wondering if anyone could...
8
by: kalinga1234 | last post by:
there is a problem regarding passing array of characters to another function(without using structures,pointer etc,).can anybody help me to solve the problem.
1
by: Eric Ellsworth | last post by:
Hi, I'm having trouble passing an array to a function, like this: Dim sFieldsNotRequired(11), sFieldsWithSpecificValues(5) As String Dim sCaseErrMsgs As String Dim vFieldsSpecificValues(5) As...
10
by: Pete | last post by:
Can someone please help, I'm trying to pass an array to a function, do some operation on that array, then return it for further use. The errors I am getting for the following code are, differences...
2
by: Manish | last post by:
Hi, I m facing a problem in re-writing a code from VB to C #. We are using a third party DLL to develop a application of Fax. The current application is already written in VB and we have to...
2
by: Tobias Olbort | last post by:
Hello, i've a outer function, which takes a params-array as a parameter. I want to pass this array to inner function with a params-array (e. g. string.format). When i've passed an integer to...
0
by: dwinson | last post by:
I am writing an add-in in C# for a server written in VB6. In order for my add-in to work I need to implement this method: MyMethod(string inputData) .... so my C# code looks like this: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.