By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,578 Members | 1,771 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,578 IT Pros & Developers. It's quick & easy.

array - how do you get the number of dimensions?

P: n/a
I want to check that an array passed in has a certain number of
dimensions - is there a way to check for this in framework 1.1 ?

Feb 15 '06 #1
Share this Question
Share on Google+
11 Replies


P: n/a
Almost everybody in this newsgroup is using VB6 or lower. While you may get
a stray answer to VB.NET (including VB2003 and VB2005 which has dropped .NET
from its name) questions here, you should ask them in newsgroups devoted
exclusively to .NET programming (the languages are different enough to
warrant separate newsgroup support). Look for newsgroups with either the
word "dotnet" or "vsnet" in their name.

For the microsoft news server, try these newsgroups for Visual Basic .NET
related questions...

microsoft.public.dotnet.languages.vb
microsoft.public.dotnet.languages.vb.upgrade
microsoft.public.dotnet.languages.vb.controls
microsoft.public.dotnet.languages.vb.data

And these for more general .NET questions

microsoft.public.dotnet.general
microsoft.public.vsnet.general

Note: There are many other .NET newgroups (use the first three "fields" from
the last two as templates when searching for them), but the above ones
should get you started.

Rick

"Mad Scientist Jr" <us*************@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I want to check that an array passed in has a certain number of
dimensions - is there a way to check for this in framework 1.1 ?

Feb 15 '06 #2

P: n/a
Almost everybody in this newsgroup is using VB6 or lower. While you may get
a stray answer to VB.NET / VB2003 / VB2005 questions here, you should ask
them in newsgroups
devoted exclusively to .NET programming. Look for newsgroups with either the
word "dotnet" or "vsnet" in their name.

For the microsoft news server, try these newsgroups...

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb
microsoft.public.vsnet.general
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"Mad Scientist Jr" <us*************@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I want to check that an array passed in has a certain number of
dimensions - is there a way to check for this in framework 1.1 ?

Feb 15 '06 #3

P: n/a
> I want to check that an array passed in has a certain number of
dimensions - is there a way to check for this in framework 1.1 ?


Http://EDais.mvps.org/DotNet/
Hope this helps,

Mike
- Microsoft Visual Basic MVP -
E-Mail: ED***@mvps.org
WWW: Http://EDais.mvps.org/
Feb 15 '06 #4

P: n/a
Hi,

Array.Rank property will give you the no. of dimensions.

BTW, I think he did post to the dotnet Newsgroup too.

Regards,

Cerebrus.

"Mad Scientist Jr" <us*************@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I want to check that an array passed in has a certain number of
dimensions - is there a way to check for this in framework 1.1 ?

Feb 15 '06 #5

P: n/a
That's strange, this posting *IS* to
microsoft.public.dotnet.languages.vb

I am using Google newsgroups
http://groups.google.com

maybe it is mistakenly posting and displaying one group as another?
Almost everybody in this newsgroup is using VB6 or lower.
For the microsoft news server, try these newsgroups...

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb
microsoft.public.vsnet.general

Feb 15 '06 #6

P: n/a
Mad Scientist Jr--

Did you mean that you want to know the allocated size of the array, or
how many values you have put into the array? Also,what type of array
is it: is it an arrayList member or just something like String()?

If it is like an arrayList, then you can just access the property:
arrayList.items.count.

if it is an array like string() then you have two ways to tell. You
can either use:
1) arrayName.length()
The method arrayName.length() will give you the number of elements
available in your array -> the size created. For example if you did :
redim arrayName(9)
then arrayName.length() would return 10.

or

2) UBound(arrayName).
This method returns the upperbound number for your array. For example
if you did:
redim arrayName(9)
then UBound(arrayName) would return 9.

As far as I know, there is not a way to determine from the array the
actual number of elements YOU put into the array declared like
string(), because when you give it an actual size, there is a default
value that is always inserted, so every item actually has a value.

Hope that this helps.
--mhos

Feb 15 '06 #7

P: n/a
"Mad Scientist Jr" <us*************@yahoo.com> schrieb
I want to check that an array passed in has a certain number of
dimensions - is there a way to check for this in framework 1.1 ?


Check it's Rank property. Usually this is only necessary if the type of the
parameter is 'Array', not integer() or integer(,) which implicitly
determines the number of dimensions.
Armin

Feb 15 '06 #8

P: n/a
Mea culpa.

I just noticed it was crossposted

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"Mad Scientist Jr" <us*************@yahoo.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
That's strange, this posting *IS* to
microsoft.public.dotnet.languages.vb

I am using Google newsgroups
http://groups.google.com

maybe it is mistakenly posting and displaying one group as another?
Almost everybody in this newsgroup is using VB6 or lower.
For the microsoft news server, try these newsgroups...

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb
microsoft.public.vsnet.general

Feb 15 '06 #9

P: n/a
Yes, rank was what I was looking for.

PS I am posting thru the google newsgroups site (groups.google.com),
and it is saying that this group is
microsoft.public.dotnet.languages.vb - i'm looking at it on my screen
right now.
Go to groups.google.com and search for "array - how do you get the
number of dimensions?" and you'll see the group name... so don't blame
me, blame the goog! It is not my intention to clog up the wrong groups
with irrelevant posts

: )

Feb 15 '06 #10

P: n/a
> That's strange, this posting *IS* to
microsoft.public.dotnet.languages.vb

I am using Google newsgroups
http://groups.google.com

maybe it is mistakenly posting and displaying one group as another?


I didn't notice the cross-post when I replied (as did others) to your
message. For future reference, the flurry of "wrong group" messages you got
is because you included microsoft.public.vb.general.discussion as one of
your groups. That group IS only meant to be only for the classic versions of
VB.

Rick
Feb 15 '06 #11

P: n/a
Just for completeness, and to compound the cross-posting issue (<grin>),
here's some VB-classic info on the same requirement:

The recommended approach is covered in knowledge-base article 152288:
http://support.microsoft.com/?id=152288

However, you can also look directly at the SafeArray descriptor, taking
account of whether it's provided via a Variant, and whether it's a static or
dynamic array (descriptor at different Variant offsets):
http://www.devx.com/vb2themax/Tip/18265

Tony Proctor
"Mad Scientist Jr" <us*************@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I want to check that an array passed in has a certain number of
dimensions - is there a way to check for this in framework 1.1 ?

Feb 16 '06 #12

This discussion thread is closed

Replies have been disabled for this discussion.