473,320 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

using ArrayList Collection class

(Sorry if this is a re-post, don't think it worked the first time)

Hello,

I am trying to add an ArrayList as a field in my web form class.

Here is a sample:

using System;
using System.Collections;
....

ArrayList myArrayList = new ArrayList();
myArrayList.Add("Belleck Colleen Vase");
myArrayList.Add("Belinda Bradshaw Cat Bowl");
myArrayList.Add("Nicholas Mosse Cat Mug");
myArrayList.Add("Shamrock Paperweight");
myArrayList.Add("Business Card Holder");

When trying to build this web form I get the error
"Invalid tocken '(' in class, struct, or interface member declaration"

Does anyone know why I can't add an ArrayList as a field in my web form
class? I want to be able to access my ArrayList in different methods within
my web form.

Thanks
Apr 28 '06 #1
3 1359
Diatom,

Seems like you have an extra ( in your code somewhere.... it is
probably just syntax error, not anything related to ArrayList at all.

HTH,
Alex

Apr 28 '06 #2
di****@newsgroup.nospam <di****@newsgroup.nospam.donotspam> wrote:
myArrayList.Add("Belleck Colleen Vase");
myArrayList.Add("Belinda Bradshaw Cat Bowl");
myArrayList.Add("Nicholas Mosse Cat Mug");
myArrayList.Add("Shamrock Paperweight");
myArrayList.Add("Business Card Holder");


You can only put these statements in a method body. You must implement an
event, override a method, or create a new method and place these
statements inside the method body.

-- Barry
Apr 28 '06 #3
Hi,

Use an array instead. if you know a priori the content of it.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"di****@newsgroup.nospam" <di****@newsgroup.nospam.donotspam> wrote in
message news:B0**********************************@microsof t.com...
(Sorry if this is a re-post, don't think it worked the first time)

Hello,

I am trying to add an ArrayList as a field in my web form class.

Here is a sample:

using System;
using System.Collections;
...

ArrayList myArrayList = new ArrayList();
myArrayList.Add("Belleck Colleen Vase");
myArrayList.Add("Belinda Bradshaw Cat Bowl");
myArrayList.Add("Nicholas Mosse Cat Mug");
myArrayList.Add("Shamrock Paperweight");
myArrayList.Add("Business Card Holder");

When trying to build this web form I get the error
"Invalid tocken '(' in class, struct, or interface member declaration"

Does anyone know why I can't add an ArrayList as a field in my web form
class? I want to be able to access my ArrayList in different methods
within
my web form.

Thanks

Apr 28 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tamir Khason | last post by:
How can I set the type of the object added to ArrayList (type of Array List Members) Here is the code: protected ArrayList tabs = new ArrayList(); public ArrayList Tabs {
2
by: j3ko | last post by:
Hi, I'm trying to start a thread that constantly iterates through an arraylist of items that the main thread adds and removes from...how would I accomplish this? Here's the gist of what I have:...
3
by: starter | last post by:
I am trying to learn IEnumerator and collections(ArrayList, Hashtable) in .NET. Can anyone tell me what is IEnumerator used for and any online resources would be helpful. Thanks
0
by: Yofnik | last post by:
Is there a way to avoid serializing an empty ArrayList? I would like the following class: public class Collection { public ArrayList Items = new ArrayList(); } ....to serialize like this:
1
by: diatom | last post by:
Hello, I am trying to add an ArrayList as a field in my web form class. Here is a sample: using System; using System.Collections; ....
5
by: res7cxbi | last post by:
I like to implement and ArrayList like Java's and C# in C++ but I have no clue how to start I really don't want to use Managed C++ and use ArrayList that way - I want to keep it "unmanaged" Can...
3
by: Michael Slattery | last post by:
Hello, I see quite a few questions, but no valid responses to the question... How do I store an ArrayList of items in a Properties file via the GUI? I am able to select the...
11
mia023
by: mia023 | last post by:
Hello everyone. Assume that we have previously defined the following class StockPurchase that has the following as instance variables a) The name of the stock (a string) b) The number of...
6
by: David C | last post by:
In my business layer, I have Person, and Patient which derives from Person. //base class for all single classes public class BaseItem{} public class Person:BaseItem{} public class...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.