Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 4th, 2004, 11:14 AM
Registered User
Join Date: Apr 2004
Location: Clarence Center, NY, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing an array in a Sub

Does anyone know how the code for passing an array to a sub or function is written.

If possible would you just show a sample snippit of the call and the sub, so I can understand how it works with an array.

I appreciate all your help.



F. Krantz
Reply With Quote
  #2 (permalink)  
Old May 4th, 2004, 01:29 PM
Authorized User
Join Date: Mar 2004
Location: Maumee, OH, USA.
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts

Try this example:

Public Sub Button1_Click(byval as System.Object, byval e as System.EventArgs) Handles Button1.click
    Dim myArray(3) as string
    'Fill array elements
    myArray(0) = "Test0"
    myArray(1) = "Test1"
    myArray(2) = "Test2"
    myArray(3) = "Test3"

    'Pass Array
    Call PassArray(myArray)
End Sub

Private Sub PassArray(byval TestArray() as string)
    dim i as integer
    'Show each array element
    for i = 0 to TestArray.GetUpperBound(0)
End Sub
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
passing parameter array Maryann BOOK: Access 2003 VBA Programmer's Reference 0 December 4th, 2006 10:56 AM
Passing a Array in of no specifc type.. John Pennington Pro VB 6 1 September 27th, 2006 05:04 PM
Passing an array to a Sub or Function donrafeal Access VBA 2 May 11th, 2006 09:39 AM
Passing php array values to javascript array gkrishna Pro PHP 0 November 6th, 2004 03:20 AM
Passing an Array of Strings to a WebService rmau Excel VBA 0 October 27th, 2003 03:59 PM

All times are GMT -4. The time now is 04:04 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.