473,396 Members | 1,933 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,396 software developers and data experts.

Getting the upper bound index of an integer array

I'd like to get the upper bound index of an integer array. I've tried the
following:

Dim i as Integer
Dim arrayIng() as Integer

i = arrayIng.GetUpperBound

This doesn't work. It seems GetUpperBound behaves more like a function in
that it wants a passed parameter. Is there not a property similar to VB6
like: i = UBound(arrayIng)

I realize that's still possible in VB .NET but isn't there a newer way of
doing it in VB .NET?

JW
Sep 24 '07 #1
3 9078

"Jerry West" <jw@comcast.netwrote in message
news:13*************@news.supernews.com...
I'd like to get the upper bound index of an integer array. I've tried the
following:

Dim i as Integer
Dim arrayIng() as Integer

i = arrayIng.GetUpperBound

This doesn't work. It seems GetUpperBound behaves more like a function in
that it wants a passed parameter. Is there not a property similar to VB6
like: i = UBound(arrayIng)

I realize that's still possible in VB .NET but isn't there a newer way of
doing it in VB .NET?

JW
It wants to know which part of an array you want the upper bound. Gets the
upper bound of the specified dimension in the System.Array. In your case
pass 0.

Hope this helps
Lloyd Sheen

Sep 24 '07 #2
This should work just fine: i = UBound(arrayIng).
"Jerry West" wrote:
I'd like to get the upper bound index of an integer array. I've tried the
following:

Dim i as Integer
Dim arrayIng() as Integer

i = arrayIng.GetUpperBound

This doesn't work. It seems GetUpperBound behaves more like a function in
that it wants a passed parameter. Is there not a property similar to VB6
like: i = UBound(arrayIng)

I realize that's still possible in VB .NET but isn't there a newer way of
doing it in VB .NET?

JW
Sep 24 '07 #3
Jerry,

I never use the upper bound or whatever.

Array.length - 1 = the latest, Array(0) is the first.

It is a pitty that in the first VB.Net beta time there is decided to keep
for real arrays a kind of compatibility with VB6 with the result now that it
keeps real arrays in VB.Net a troublefull situation.

An array in VB.Net is created with one extra in a way that you can use the
length and the count, however as well the bounds. To keep projects with
interchangeble languages, I will always avoid in this the starting index 1.
Be aware that this 1 extra is only for true arrays and the old not
Icollection implementing VB.Net collection. For the rest all lists and
collections and the generic versions of that behave as in all languages in
dotNet from zero to the length of the array.

Cor

"Jerry West" <jw@comcast.netschreef in bericht
news:13*************@news.supernews.com...
I'd like to get the upper bound index of an integer array. I've tried the
following:

Dim i as Integer
Dim arrayIng() as Integer

i = arrayIng.GetUpperBound

This doesn't work. It seems GetUpperBound behaves more like a function in
that it wants a passed parameter. Is there not a property similar to VB6
like: i = UBound(arrayIng)

I realize that's still possible in VB .NET but isn't there a newer way of
doing it in VB .NET?

JW
Sep 24 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: melanieab | last post by:
Hi, Easy question. It seems to me that I'm following the examples correctly, but apparently I'm not. I'm trying to retrieve the data from a row called "row" and a column called "File". This is...
1
by: Ike | last post by:
Does anyone here remember how to discern the upper bound of an array in asp, pre-.NET ? Thanks, Ike
4
by: bienwell | last post by:
Hi all, Data displayed on the datalist control is bound by the column name of the dataset like this : <%# DataBinder.Eval(Container.DataItem, "title")%> Could I use an element of the array...
0
by: Adam J. Schaff | last post by:
Hello. I have a custom collection that implements IBindingList (allownew and allowremove are both true). I have bound it to a datagrid. I have add and remove buttons on the screen. I want to...
12
by: Jared Carr | last post by:
First I wish I knew how this was caused but here is our problem. Sometime in the recent past we got a duplicate table. Here is the result of a pg_dump with a pg_restore for just that table. ...
14
by: Rich | last post by:
Yes, I need to store some values in an array type collection object that can hold 3 or more parameters per index. I have looked at the collection object, hashtable object and would prefer not to...
8
by: csanjith | last post by:
Hi, i have a situaion where i need to convert the characters entered in an text field to upper case using C. The configuration id utf8 environment in which user can enter any character (single ,...
5
by: njb35 | last post by:
Hi all I'm beginning my foray from VBA into VB 2005 Express, and enjoying some of the efficiencies it provides! I'm stuck with some dataset handling however that I _think_ can be automated but...
9
by: =?Utf-8?B?R2Vla0JveQ==?= | last post by:
I did not see another group for this so I presume this is the correct one to ask such a question. Anyway, I need to get data entered into a textbox and put it all into an array. I have looked...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.