Technology Programming

How to Find the Length of String Array in VB 6.0

    • 1). Declare the array to hold string data by providing a name followed by parenthesis. "Dim myArray(9) as String" will declare an array called "myArray" that holds 10 elements of the String datatype. The String datatype can store up to 4 billion characters, including letters and numbers.

    • 2). Use the "ubound" function to get the size of the array. The array created in Step 1 would return 9 from the following statement: "ubound(myArray)". If the array was declared with an empty parenthesis, meaning the size had not yet been determined, the "ubound" function would return a "subscript out of range" error.

    • 3). Populate the array with data. Reference the array element by number and set that equal to the new value. For example, "myArray(0) = "Test"" will set the first element equal to the word "Test".

    • 4). Get the length of the array element by using the "Len" function. The first array element referenced in Step 3 is set to the word "Test" which is 4 characters long. Coding "Len(myArray(0))" returns 4.

    • 5). Change the size of any array using the "Redim" statement. If you wish to keep the existing elements intact, use "Redim Preserve" when resizing. "Redim myArray(15)" will reset all the values in "myArray" and allow the array to now hold sixteen values.

SHARE
RELATED POSTS on "Technology"
Blitzerwarner: Could You Escape the Speed Cameras?
Blitzerwarner: Could You Escape the Speed Cameras?
What Makes a Perfect Web Design Company?
What Makes a Perfect Web Design Company?
Inside No-Fuss Products In Gaming Computers
Inside No-Fuss Products In Gaming Computers
Gaming Institute, Game Design Schools at PAI-ILS, PAI International Learning Solutions Pune
Gaming Institute, Game Design Schools at PAI-ILS, PAI International Learning Solutions Pune
Free Music Players For Websites
Free Music Players For Websites
'See How NCP Tracks Down Fake Ration Card Holders'
'See How NCP Tracks Down Fake Ration Card Holders'
You Can Stop Panic Attacks in Just two Minutes
You Can Stop Panic Attacks in Just two Minutes
WordPress Blog to WP Site! A Journey to Online Success
WordPress Blog to WP Site! A Journey to Online Success
Videos will give your business portal an extra leverage
Videos will give your business portal an extra leverage
Excellent Ways To Make Weight Loss Work For You
Excellent Ways To Make Weight Loss Work For You
Five Notable Differences between National and International Logo Designs
Five Notable Differences between National and International Logo Designs
Who Should Your Phoenix Web Design Client Be?
Who Should Your Phoenix Web Design Client Be?
White Papers & Other Documents - including ALFLB
White Papers & Other Documents - including ALFLB
Google Analytics Tips
Google Analytics Tips
Want To Make Your Website Faster? Follow These Steps
Want To Make Your Website Faster? Follow These Steps
The Starting of Couture Apparel
The Starting of Couture Apparel
Choose Custom Website Design Services
Choose Custom Website Design Services
Choosing the Right Joomla CMS Developer
Choosing the Right Joomla CMS Developer
A Look at SQL Server Denali AlwaysOn
A Look at SQL Server Denali AlwaysOn
4 Tips to Choose the Perfect Flash Animation Course
4 Tips to Choose the Perfect Flash Animation Course

Leave Your Reply

*