Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 18th, 2003, 09:58 AM
Registered User
 
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 Array's "Going backwards"

Hello,

I'm new to vb but have alway's wanted to learn it. I have a question regarding the Try it out going backwards...

In the try it out i'm not quite clear how they use the length property to find out how big it is? How does subtracting one from the upper bound find the correct size? I would think that vb was programed to know it uses zero based lengths and therefore subtracting one from the upper bound would yield 4 instead.

 
Old November 18th, 2003, 10:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Chapter 6 of what book?

In any case- take the following array

a(0) = "Hello"
a(1) = "World"
a(2) = "In"
a(3) = "Array"

UBOUND(A) would yeild 4

Looping from 0-4 would cause an error as a(4) doesn't exist. so you need to Loop 0 to ubound(a)-1...

The ubound gives the actual number of array members- so an array with 1 element would be at position zero...

Follow?


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
 
Old November 19th, 2003, 02:18 PM
Registered User
 
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Hal,

Shortly after I posted I called a friend to explain the problem to him (he know's nothing about programing either) and during the explanation I figured it out, lol.

Thanks for your help though.








Similar Threads
Thread Thread Starter Forum Replies Last Post
Byte array's ".getLength" and ".Length" yukijocelyn C# 2005 4 August 6th, 2008 12:31 PM
change only the first item in array's back color i remya1000 .NET Framework 1.x 1 November 5th, 2007 10:43 PM
Backwards compatable XSLT 2.0 boen_robot XSLT 4 October 4th, 2006 03:36 PM
Domain name validation - backwards?? rptasiuk Pro PHP 7 July 20th, 2004 04:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.