424,983 Members | 2,035 Online
Need help? Post your question and get tips & solutions from a community of 424,983 IT Pros & Developers. It's quick & easy.

# Defining the range of an array

 P: n/a If we declar a varible as: Dim series(10) as Double then series can contain 11 items in maximum ( 0 - 11 ). How do you declar this varible, making the first item as series(1) instead of series(0) ? Thanks. -- Xero http://www.chezjeff.net My personal web portal Nov 21 '05 #1
6 Replies

 P: n/a Hi. Sorry you cant. The first element in an array is zero in vb.net Ken ----------------- "Xero" wrote in message news:B2**********************************@microsof t.com... If we declar a varible as: Dim series(10) as Double then series can contain 11 items in maximum ( 0 - 11 ). How do you declar this varible, making the first item as series(1) instead of series(0) ? Thanks. -- Xero http://www.chezjeff.net My personal web portal Nov 21 '05 #2

 P: n/a Jeff, A little addition to Ken then series can contain 11 items in maximum ( 0 - 11 ). (0 - 10) Than you understand probably why Cor Nov 21 '05 #3

 P: n/a You are saying that the first item in the array is series(0) and the tenth item (i.e. the last item) in the array is series(10) This statement Dim series(10) as Double actually can accommodate 10 items only. Am I correct? Xero "Cor Ligthert" wrote: Jeff, A little addition to Ken then series can contain 11 items in maximum ( 0 - 11 ). (0 - 10) Than you understand probably why Cor Nov 21 '05 #4

 P: n/a Jeff, It is a strange way of keeping compatibility that is taken, and maybe it could have been avoided, however all methods or whatever in the VB namespace is using for indexing the start index First where First is 1. The rest of dotnet methods or whatever are using for First the zero. Although I am used to the zero start indexer, is in my opinion the way VB does it better. However, you cannot turn history back so most of us with not only VB background are using the zero indexer. Dim i(10) as integer are 11 integers in an array. Usable from 0 to 10 what are eleven or 1 to 10 what are ten integers And therefore I use dim i(9) as integer when I want 10 integer is an array. It looks strange, however I hope this helps anyway something. Cor "Xero" You are saying that the first item in the array is series(0) and the tenth item (i.e. the last item) in the array is series(10) This statement Dim series(10) as Double actually can accommodate 10 items only. Am I correct? Xero "Cor Ligthert" wrote: Jeff, A little addition to Ken > > then series can contain 11 items in maximum ( 0 - 11 ). (0 - 10) Than you understand probably why Cor Nov 21 '05 #5

 P: n/a Xero, No, when dimensioning an array, you specifiy the upper bound of the array, with the lower bound always being zero. So, Dim series (10) As Double will produce an array with 11 elements, numbered 0 through 10. Kerry Moorman "Xero" wrote: You are saying that the first item in the array is series(0) and the tenth item (i.e. the last item) in the array is series(10) This statement Dim series(10) as Double actually can accommodate 10 items only. Am I correct? Xero "Cor Ligthert" wrote: Jeff, A little addition to Ken then series can contain 11 items in maximum ( 0 - 11 ). (0 - 10) Than you understand probably why Cor Nov 21 '05 #6

 P: n/a I see ... Thanks, guys! Xero "Cor Ligthert" wrote: Jeff, It is a strange way of keeping compatibility that is taken, and maybe it could have been avoided, however all methods or whatever in the VB namespace is using for indexing the start index First where First is 1. The rest of dotnet methods or whatever are using for First the zero. Although I am used to the zero start indexer, is in my opinion the way VB does it better. However, you cannot turn history back so most of us with not only VB background are using the zero indexer. Dim i(10) as integer are 11 integers in an array. Usable from 0 to 10 what are eleven or 1 to 10 what are ten integers And therefore I use dim i(9) as integer when I want 10 integer is an array. It looks strange, however I hope this helps anyway something. Cor "Xero" You are saying that the first item in the array is series(0) and the tenth item (i.e. the last item) in the array is series(10) This statement Dim series(10) as Double actually can accommodate 10 items only. Am I correct? Xero "Cor Ligthert" wrote: Jeff, A little addition to Ken > > then series can contain 11 items in maximum ( 0 - 11 ). (0 - 10) Than you understand probably why Cor Nov 21 '05 #7

### This discussion thread is closed

Replies have been disabled for this discussion.