|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
A Question on Arrays.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 > I am kinda new to VB 6.0. You must be new to this newsgroup to - it's a .NET (vb2002, vb2003, andvb2005) 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: Show quoteHide quote > 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 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: Show quoteHide quote > > 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 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: Show quoteHide quote > 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 rowe_newsgroups wrote:
> Oops, I made a mistake there - it should be an array sized 63 x 3 (189 That is incorrect, the VB.Net behavior is the same as VB6. Dim str(4)> 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 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. > In the beginning, VB.Net worked the way C# did, with the number Thanks for the correction! Which version switched this back?> 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, Seth Rowe Chris Dunaway wrote: Show quoteHide quote > 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. rowe_newsgroups wrote:
> > In the beginning, VB.Net worked the way C# did, with the number Version 1.0. The new syntax never made it out of beta IIRC.> > 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? > 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: Show quoteHide quote > 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. 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: Show quoteHide quote > > 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 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). Show quoteHide quote "Learner" <pra***@gmail.com> wrote in message news:1163434486.240149.94660@m73g2000cwd.googlegroups.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 >
System.Timers.Timer, thread synchronization issues
Thread.Sleep slowing down the whole application DataGridViewCell has lost its DataGridView - How to solve? COM object that has been separated from its underlying RCW... Insert Creating an array of textbox objects Debugger question Crystal Reports Logon Problem Don't see application events question about variables and subprocedure |
|||||||||||||||||||||||