Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Array declaration


Message #1 by "Jignesh" <techegroups@r...> on Wed, 14 Mar 2001 06:00:51
In your ASP+ book the syntax for declaring and initializing array is given 

as



 dim myarr(5) as integer = (1,2,3,4,5)



 But it results in an following error. 



Compiler Error Message: BC30672: Explicit initialization is not permitted 

for arrays declared with explicit sizes.



Source Error:

Line 7:  <%

Line 8:  

Line 9:   dim myarr(5) as integer = (1,2,3,4,5)

Line 10: 

Line 11: %>



Message #2 by davids@i... on Thu, 15 Mar 2001 16:22:17
Ah, then this is an error. You should just be able to do:



Dim myArr() As Integer = (1, 2, 3, 4, 5)



The size of the array is calculated from the initialisers.



Dave





> In your ASP+ book the syntax for declaring and initializing array is 

given 

> as

> 

>  dim myarr(5) as integer = (1,2,3,4,5)

> 

>  But it results in an following error. 

> 

> Compiler Error Message: BC30672: Explicit initialization is not 

permitted 

> for arrays declared with explicit sizes.

> 

> Source Error:

> Line 7:  <%

> Line 8:  

> Line 9:   dim myarr(5) as integer = (1,2,3,4,5)

> Line 10: 

> Line 11: %>

> 


  Return to Index