473,799 Members | 2,972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create an Unknown Number of ArrayLists

I would like to create an unknown number of Arraylists, meaning, I don't know
how many I should create until runtime.

I will be reading a table, and 0,1,2, or more fields have to be put into
individual ArrayLists.

How do I create an unknown number of ArrayLists?

Right now I put all the values into one ArrayList. I know how many fields
are in the ArrayList so I then know that every one, or every other one, or
every third one goes together. I would like three separate lists, OR, a way
to enumerate the fields as I put them in the one ArrayList.

I do know how many fields I have at runtime.
Nov 1 '06 #1
4 1689
Andy in S. Jersey wrote:
How do I create an unknown number of ArrayLists?
How about a list of lists?

--

..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.
Nov 1 '06 #2
I don't necessarily know the type of collection I want to make. Will List
still be OK?

That's what I like about ArrayList, any type can be put in.

"Jon Shemitz" wrote:
Andy in S. Jersey wrote:
How do I create an unknown number of ArrayLists?

How about a list of lists?

--

..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.
Nov 1 '06 #3
i have done something similar,

but what I did was create a class with properties,
and make that class into an array.

As I need to create more elements, I use a Redim with a preserve on it.
I know it says this takes more time and such, but ill take the extra 2
seconds of processing time :)
-it made my life easier down the road.

M.
"Andy in S. Jersey" <An***********@ discussions.mic rosoft.comwrote in
message news:6E******** *************** ***********@mic rosoft.com...
>I don't necessarily know the type of collection I want to make. Will List
still be OK?

That's what I like about ArrayList, any type can be put in.

"Jon Shemitz" wrote:
>Andy in S. Jersey wrote:
How do I create an unknown number of ArrayLists?

How about a list of lists?

--

..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.

Nov 1 '06 #4
Andy in S. Jersey wrote:
I don't necessarily know the type of collection I want to make. Will List
still be OK?

That's what I like about ArrayList, any type can be put in.
I did mean an ArrayList of ArrayList-s or (better) a
List<List<objec t>>.
How do I create an unknown number of ArrayLists?
How about a list of lists?
--

..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.
Nov 1 '06 #5

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

Similar topics

9
3560
by: Albretch | last post by:
.. I am trying to create a database in a MS Access DB via JDBC drivers. I have tried both sun.jdbc.odbc.JdbcOdbcDriver and ids.sql.IDSDriver From some reason both drivers Exceptions tell me 'Syntax error in CREATE TABLE statement' even though I am not creating a table, but a Database // - - - - - - - - - - - - sun.jdbc.odbc.JdbcOdbc aSQL=CREATE DATABASE dbtest; java.sql.SQLException:
11
1570
by: Gene | last post by:
I want to create a certain number of arrays on the same time to use, is it possible to do that?
5
2395
by: drdave | last post by:
I would like to have ten arraylists created within a loop.. is there a conversion or something I can do to acheive this.. pseudo: Dim counter As Integer = 0 Dim ArrName As ArrayList '******** LOOP OVER THE VALUES ********************
3
3217
by: steve | last post by:
I need to compare the value of a field in a row on an arraylist with the value of a field on a second arraylist I have this bit of code working for arrays but cant get it working for arraylists The secone argument here (1) represents the second field in the row, with arraylists I get a message saying to many arguments. Can I do this with arraylists or do I need to copy the arraylists to arrays? Thanks For q As Integer = 0 To 9 For j...
2
4014
by: Andy in S. Jersey | last post by:
I would like to create an unknown number of ArrayLists, that is I don't know that until runtime. Of course I can do this if I knew I needed two: ArrayList IntervalArray1 = new ArrayList(); ArrayList IntervalArray2 = new ArrayList(); but what if I don't know how many I need at build time?
4
11339
by: Abdhul Saleem | last post by:
Hi, I am recieving error ActiveX component can't create object in the following line in the asp page. set ExcelApp = CreateObject("Excel.Application") Previously this code was working fine. Thanks in advance.
16
2972
by: vbnewbie | last post by:
I need to create a number of arraylists at run time. The number of arraylists to be created is unknown at design time. The name of the first newly created arraylist is the first element of an array, NameArray (a Publicly declared array with an unknown number of elements at design time). The name of the second newly created arraylist is the second element of NameArray, etc Problem 1: How can I retrieve that name from NameArray and...
4
12451
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
4
4039
by: omono84 | last post by:
I know that this should be rather simple but i seem to be missing a step to get it to work. and have been unable to find a solution on the net. The aim is that I click on the open button to find and open an unknown workbook that contains the data that I need to imput into my current workbook, once the unknown workbook is opened it should automatically select my range (number of columns known, but number of rows unknown- the number of rows...
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9546
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10247
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10031
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9079
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5593
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.