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

A Question on Arrays.

Hello ,
I am kinda new to VB 6.0. Is the line of code
Private strCol(62, 2) As String declares a three dimensional array?

Because in the code it is being used
as
strCol(1,0) = "x"
strCol(2,0 )= "x"
strcol(3,0) = "x"
....
strCol(1,1) = "x"
strCol(2,1) = "x"
....
strCol(1,2) = "x"
strCol(2,2) = "x"
strCol(3,2) = "x"
Please take a moment to explain.
thanks
-L

Nov 13 '06 #1
9 1453
I am kinda new to VB 6.0.

You must be new to this newsgroup to - it's a .NET (vb2002, vb2003, and
vb2005) newgroup not a VB classic (vb1 - 6) newsgroup. You should post
VB classic questions to the microsoft.public.vb ng.

But since the question does apply to vb.Net I'll go ahead and answer.
The code you provided declares a two dimensional array. 2 dimensional
arrays are sort of like a standard database table. In this case it
would be a 62 by 2 table (which means it has 124 cells). So when you do
strCol(1,2) = "x" you are just putting the string "x" into cell (1, 2).

Does that make more sense?

Thanks,

Seth Rowe
Learner wrote:
Hello ,
I am kinda new to VB 6.0. Is the line of code
Private strCol(62, 2) As String declares a three dimensional array?

Because in the code it is being used
as
strCol(1,0) = "x"
strCol(2,0 )= "x"
strcol(3,0) = "x"
...
strCol(1,1) = "x"
strCol(2,1) = "x"
...
strCol(1,2) = "x"
strCol(2,2) = "x"
strCol(3,2) = "x"
Please take a moment to explain.
thanks
-L
Nov 13 '06 #2
Hello rowe,
Thanks for answering my question. I understand your explanation. But
the thing I don't understand is

1st set with '0'
strCol(1,0)
strCol(2,0)
....
strCol(62,0)

2nd set with '1'
strCol(1,1)
strCol(2,1)
.....
strCol(62,1)
3rd set with '2'
strCor(1,2)
strCol(2,2)
....
strCol(62,2)
is not it 62X3 = 186 as it starts with '0' ?

Please take one more minute to clarify.

thanks
-L
rowe_newsgroups wrote:
I am kinda new to VB 6.0.

You must be new to this newsgroup to - it's a .NET (vb2002, vb2003, and
vb2005) newgroup not a VB classic (vb1 - 6) newsgroup. You should post
VB classic questions to the microsoft.public.vb ng.

But since the question does apply to vb.Net I'll go ahead and answer.
The code you provided declares a two dimensional array. 2 dimensional
arrays are sort of like a standard database table. In this case it
would be a 62 by 2 table (which means it has 124 cells). So when you do
strCol(1,2) = "x" you are just putting the string "x" into cell (1, 2).

Does that make more sense?

Thanks,

Seth Rowe
Learner wrote:
Hello ,
I am kinda new to VB 6.0. Is the line of code
Private strCol(62, 2) As String declares a three dimensional array?

Because in the code it is being used
as
strCol(1,0) = "x"
strCol(2,0 )= "x"
strcol(3,0) = "x"
...
strCol(1,1) = "x"
strCol(2,1) = "x"
...
strCol(1,2) = "x"
strCol(2,2) = "x"
strCol(3,2) = "x"
Please take a moment to explain.
thanks
-L
Nov 13 '06 #3
Hello rowe,
Thanks for answering my question. I understand your explanation. But
the thing I don't understand is

1st set with '0'
strCol(1,0)
strCol(2,0)
....
strCol(62,0)

2nd set with '1'
strCol(1,1)
strCol(2,1)
.....
strCol(62,1)
3rd set with '2'
strCor(1,2)
strCol(2,2)
....
strCol(62,2)
is not it 62X3 = 186 as it starts with '0' ?

Please take one more minute to clarify.

thanks
-L
rowe_newsgroups wrote:
I am kinda new to VB 6.0.

You must be new to this newsgroup to - it's a .NET (vb2002, vb2003, and
vb2005) newgroup not a VB classic (vb1 - 6) newsgroup. You should post
VB classic questions to the microsoft.public.vb ng.

But since the question does apply to vb.Net I'll go ahead and answer.
The code you provided declares a two dimensional array. 2 dimensional
arrays are sort of like a standard database table. In this case it
would be a 62 by 2 table (which means it has 124 cells). So when you do
strCol(1,2) = "x" you are just putting the string "x" into cell (1, 2).

Does that make more sense?

Thanks,

Seth Rowe
Learner wrote:
Hello ,
I am kinda new to VB 6.0. Is the line of code
Private strCol(62, 2) As String declares a three dimensional array?

Because in the code it is being used
as
strCol(1,0) = "x"
strCol(2,0 )= "x"
strcol(3,0) = "x"
...
strCol(1,1) = "x"
strCol(2,1) = "x"
...
strCol(1,2) = "x"
strCol(2,2) = "x"
strCol(3,2) = "x"
Please take a moment to explain.
thanks
-L
Nov 13 '06 #4
Oops, I made a mistake there - it should be an array sized 63 x 3 (189
cells) - Arrays where revamped in .NET so that dim str(4) as string
would declare an array with four members (str(0), str(1), str(2) and
str(3)) That same statement in vb classic declares an array with 5
members (str(0), str(1), str(2), str(3) and str(4)). This is one of the
many things that changed in .Net, and is a terrific example of why the
two newgroups are seperate from each other. If this same question was
posted in the vb classic ng they would have used the vb6 definition of
an array and correctly answered your question.

Thanks,

Seth Rowe
Learner wrote:
Hello rowe,
Thanks for answering my question. I understand your explanation. But
the thing I don't understand is

1st set with '0'
strCol(1,0)
strCol(2,0)
...
strCol(62,0)

2nd set with '1'
strCol(1,1)
strCol(2,1)
....
strCol(62,1)
3rd set with '2'
strCor(1,2)
strCol(2,2)
...
strCol(62,2)
is not it 62X3 = 186 as it starts with '0' ?

Please take one more minute to clarify.

thanks
-L
rowe_newsgroups wrote:
I am kinda new to VB 6.0.
You must be new to this newsgroup to - it's a .NET (vb2002, vb2003, and
vb2005) newgroup not a VB classic (vb1 - 6) newsgroup. You should post
VB classic questions to the microsoft.public.vb ng.

But since the question does apply to vb.Net I'll go ahead and answer.
The code you provided declares a two dimensional array. 2 dimensional
arrays are sort of like a standard database table. In this case it
would be a 62 by 2 table (which means it has 124 cells). So when you do
strCol(1,2) = "x" you are just putting the string "x" into cell (1, 2).

Does that make more sense?

Thanks,

Seth Rowe
Learner wrote:
Hello ,
I am kinda new to VB 6.0. Is the line of code
Private strCol(62, 2) As String declares a three dimensional array?
>
Because in the code it is being used
as
strCol(1,0) = "x"
strCol(2,0 )= "x"
strcol(3,0) = "x"
...
strCol(1,1) = "x"
strCol(2,1) = "x"
...
strCol(1,2) = "x"
strCol(2,2) = "x"
strCol(3,2) = "x"
>
>
Please take a moment to explain.
>
>
thanks
-L
Nov 13 '06 #5
This is a rather unfortunate aspect of arrays: whether they are Zero or One
based. For example, if I declare a simple array as follows:

Dim myIntegers (1),

you might think I'm declaring one integer, but no, I'm declaring 2!
myIntegers (0) and myIntegers (1). The dimension in brackets represents the
upper inclusive bound on the set 0..1.

Now, your declaration, (62, 2), means you have 3 rows ( 0..2 ) with 63
columns ( 0..62 ), so in total you have 63 * 3 "cells" (189).


"Learner" <pr****@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
Hello rowe,
Thanks for answering my question. I understand your explanation. But
the thing I don't understand is

1st set with '0'
strCol(1,0)
strCol(2,0)
...
strCol(62,0)

2nd set with '1'
strCol(1,1)
strCol(2,1)
....
strCol(62,1)
3rd set with '2'
strCor(1,2)
strCol(2,2)
...
strCol(62,2)
is not it 62X3 = 186 as it starts with '0' ?

Please take one more minute to clarify.

thanks
-L
rowe_newsgroups wrote:
I am kinda new to VB 6.0.

You must be new to this newsgroup to - it's a .NET (vb2002, vb2003, and
vb2005) newgroup not a VB classic (vb1 - 6) newsgroup. You should post
VB classic questions to the microsoft.public.vb ng.

But since the question does apply to vb.Net I'll go ahead and answer.
The code you provided declares a two dimensional array. 2 dimensional
arrays are sort of like a standard database table. In this case it
would be a 62 by 2 table (which means it has 124 cells). So when you do
strCol(1,2) = "x" you are just putting the string "x" into cell (1, 2).

Does that make more sense?

Thanks,

Seth Rowe
Learner wrote:
Hello ,
I am kinda new to VB 6.0. Is the line of code
Private strCol(62, 2) As String declares a three dimensional array?

Because in the code it is being used
as
strCol(1,0) = "x"
strCol(2,0 )= "x"
strcol(3,0) = "x"
...
strCol(1,1) = "x"
strCol(2,1) = "x"
...
strCol(1,2) = "x"
strCol(2,2) = "x"
strCol(3,2) = "x"
Please take a moment to explain.
thanks
-L

Nov 13 '06 #6
rowe_newsgroups wrote:
Oops, I made a mistake there - it should be an array sized 63 x 3 (189
cells) - Arrays where revamped in .NET so that dim str(4) as string
would declare an array with four members (str(0), str(1), str(2) and
That is incorrect, the VB.Net behavior is the same as VB6. Dim str(4)
declares an array with 5 members. 0, 1, 2, 3, 4.

In the beginning, VB.Net worked the way C# did, with the number
indicating the number of members, but they changed it back to the VB6
way because there were many complaints that it broke compatibility with
VB6 code.

Nov 13 '06 #7
In the beginning, VB.Net worked the way C# did, with the number
indicating the number of members, but they changed it back to the VB6
way because there were many complaints that it broke compatibility with
VB6 code.
Thanks for the correction! Which version switched this back?

Thanks,

Seth Rowe
Chris Dunaway wrote:
rowe_newsgroups wrote:
Oops, I made a mistake there - it should be an array sized 63 x 3 (189
cells) - Arrays where revamped in .NET so that dim str(4) as string
would declare an array with four members (str(0), str(1), str(2) and

That is incorrect, the VB.Net behavior is the same as VB6. Dim str(4)
declares an array with 5 members. 0, 1, 2, 3, 4.

In the beginning, VB.Net worked the way C# did, with the number
indicating the number of members, but they changed it back to the VB6
way because there were many complaints that it broke compatibility with
VB6 code.
Nov 13 '06 #8
rowe_newsgroups wrote:
In the beginning, VB.Net worked the way C# did, with the number
indicating the number of members, but they changed it back to the VB6
way because there were many complaints that it broke compatibility with
VB6 code.

Thanks for the correction! Which version switched this back?
Version 1.0. The new syntax never made it out of beta IIRC.

Nov 13 '06 #9
That'll teach me to believe an article about "whats new in vb.net" that
was written during beta testing :-)

Thanks,

Seth Rowe
Chris Dunaway wrote:
rowe_newsgroups wrote:
In the beginning, VB.Net worked the way C# did, with the number
indicating the number of members, but they changed it back to the VB6
way because there were many complaints that it broke compatibility with
VB6 code.
Thanks for the correction! Which version switched this back?

Version 1.0. The new syntax never made it out of beta IIRC.
Nov 13 '06 #10

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

Similar topics

19
by: Canonical Latin | last post by:
"Leor Zolman" <leor@bdsoft.com> wrote > "Canonical Latin" <javaplus@hotmail.com> wrote: > > > ... > >But I'm still curious as to the rational of having type >...
21
by: Matteo Settenvini | last post by:
Ok, I'm quite a newbie, so this question may appear silly. I'm using g++ 3.3.x. I had been taught that an array isn't a lot different from a pointer (in fact you can use the pointer arithmetics to...
5
by: JezB | last post by:
What's the easiest way to concatenate arrays ? For example, I want a list of files that match one of 3 search patterns, so I need something like DirectoryInfo ld = new DirectoryInfo(searchDir);...
3
by: Michel Rouzic | last post by:
It's the first time I try using structs, and I'm getting confused with it and can't make it work properly I firstly define the structure by this : typedef struct { char *l1; int *l2; int Nval; }...
1
by: Rob Griffiths | last post by:
Can anyone explain to me the difference between an element type and a component type? In the java literature, arrays are said to have component types, whereas collections from the Collections...
41
by: Rene Nyffenegger | last post by:
Hello everyone. I am not fluent in JavaScript, so I might overlook the obvious. But in all other programming languages that I know and that have associative arrays, or hashes, the elements in...
6
by: Robert Bravery | last post by:
Hi all, Can some one show me how to achieve a cross product of arrays. So that if I had two arrays (could be any number) with three elements in each (once again could be any number) I would get:...
1
by: Doug_J_W | last post by:
I have a Visual Basic (2005) project that contains around twenty embedded text files as resources. The text files contain two columns of real numbers that are separated by tab deliminator, and are...
16
by: mike3 | last post by:
(I'm xposting this to both comp.lang.c++ and comp.os.ms- windows.programmer.win32 since there's Windows material in here as well as questions related to standard C++. Not sure how that'd go over...
29
weaknessforcats
by: weaknessforcats | last post by:
Arrays Revealed Introduction Arrays are the built-in containers of C and C++. This article assumes the reader has some experiece with arrays and array syntax but is not clear on a )exactly how...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.