ArrayList in web user control

F

Fabri

Please can u tell me why this code does not work:

<%@ Control Language="VB" ClassName="WebUserControl" %>

<script runat="server">

' To create an ArrayList, first, we must dimension it:

Dim MyArrayList as ArrayList

' Then, to create a space for it in memory:

MyArrayList = New Arraylist

</script>

It returns me an error:

Declaration expected on "MyArrayList = New Arraylist"

Any help appreciated.

Best regards.

--
fabri
Sei un italiano medio, di oltre trent'anni se:
Sai che il codice SYS64738 serviva per riavviare il Commodore 64 ed hai
cambiato almeno una mezza dozzina di joystick Quickshot I giocando a
Summer Games.
MKDS nick & friend Code:
Joker® - 055895 043343
 
F

Fabri

dkode said:
MyArrayList = New ArrayList()


Nope.

What is it?

Simple rows:

<script runat="server">

' To create an ArrayList, first, we must dimension it:

Dim MyArrayList as ArrayList

' Then, to create a space for it in memory:

MyArrayList = New Arraylist()

</script>

do not work :-(

--
fabri
Sei un italiano medio, di oltre trent'anni se:
Sai che il codice SYS64738 serviva per riavviare il Commodore 64 ed hai
cambiato almeno una mezza dozzina di joystick Quickshot I giocando a
Summer Games.
MKDS nick & friend Code:
Joker® - 055895 043343
 
A

Anthony Merante

You should be able to do this:
Dim MyArrayList as New ArrayList()

Make sure you have :

imports System.Collections

Viva Italia
-Tony
 
B

Bruce Barker

you are confusing a couple of issues.

Dim MyArrayList as ArrayList ' define a varible of type ArrayList
set to nothing.
MyArrayList = New Arraylist ' set valiable to new empty arraylist

now in an aspnet script block, only variable, sub or function declartions
are allowed, so the second statement is an error. you can combine then
though (if i remeber vb.net syntax)

<script runat="server">
Dim MyArrayList as New ArrayList
</script>

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Cool book 1

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top