Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Changes to arrays between Visual Basic 6.0 and Visual Basic .NET
WhatsApp
Dinesh Beniwal
15y
3.5
k
0
0
25
Blog
Array Bound Changes in Visual Basic
Visual Basic .NET updates the declaration of array bounds to provide interoperability with arrays in other programming languages.
Visual Basic 6.0
In Visual Basic 6.0, the default lower bound of every dimension of an array is 0. You can change this to 1 with the
Option Base
statement. You can also override the default lower bound in individual array declarations.
If you leave the default at 0, the number of elements in the array is equal to the upper bound plus one. The following declaration reserves 21 elements for the array
Weight
:
Dim Weight(20) As Single
Visual Basic .NET
In Visual Basic .NET, the lower bound of every array dimension is 0, and you cannot declare it to be otherwise. The Option Base statement is not supported.
The number you specify for each dimension in the declaration is the upper bound, and the initial element count is equal to the upper bound plus one. The declaration in the preceding example reserves 21 elements for
Weight
, with subscripts 0 through 20.
You can also specify a
zero-length array
, which does not contain any elements, by declaring one of its upper bounds to be –1.
People also reading
Membership not found