Solved

VBScript array declaration not allowed by .NET framework

Posted on 2004-08-18
4
852 Views
Last Modified: 2008-01-09
This file works when named "test.asp" but breaks when named "test.aspx".  This means that the .NET ASPX compiler is choking on perfectly valid VBScript notation.  The error message returned is "BC30684: 'Array' is a type and cannot be used as an expression."

----[code start]------------------------------------------------------------

<%
Dim arrTest : arrTest = Array( 1337 )
Response.Write( arrTest( 0 ) )
%>

----[code end]------------------------------------------------------------

This has always been legit VBScript in ASP 3.  Why does .NET no longer think so?
0
Comment
Question by:hyperslug
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 31

Expert Comment

by:alorentz
ID: 11833953
VBScript is primitive.  Try this:

Dim arrTest(1337) as Array
Response.Write( arrTest( 0 ) )
0
 
LVL 31

Accepted Solution

by:
alorentz earned 50 total points
ID: 11833962
.Net works like VB, not VBScript.  I don't have .Net open so didn't test that..
0
 
LVL 3

Author Comment

by:hyperslug
ID: 11834317
Ahhh, good call.  I did try your example but I think it created an uninitialized 1,337 element array so it had no output.
But I did look up VB.NET syntax and found that this works:

<%
'Dim arrTest : arrTest = Array( 1337 )      'VBScript notation, not valid in .NET
Dim arrTest() As Integer = { 1337 }        'VB.NET notation, default @Page language
Response.Write( arrTest( 0 ) )
%>

Note the previous VBScript line is commented out.

I guess all my code has been compiling as valid VB.NET even though I thought I was coding in plain old VBScript.  Hmmm all this time.  Anyway, thanks alorentz.
0
 
LVL 31

Expert Comment

by:alorentz
ID: 11834378
Good luck!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Jquery Check against database on select from auto fill not working in all browsers 5 56
Hide cell in a table 2 42
Debugging Html 8 41
Table doesn't show the lines! 3 36
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question