473,614 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to increase the 2-dimensional Array size dynamically.?

Hi,

In my application, I need to increase the 2-dimensional array size
dynamically.

Please let me know the procedure to declare a dynamic 2-dimensional array
like Single dimensional array, ArrayList.

Thanks,
Mohan
Nov 17 '05 #1
1 7261
Mohan wrote:
In my application, I need to increase the 2-dimensional array size
dynamically.

Please let me know the procedure to declare a dynamic 2-dimensional array
like Single dimensional array, ArrayList.


An ArrayList, which can be dynamically increased in size, is not an
array. It's not possible to increase arrays in size dynamically,
regardless of the number of their dimensions.

Of course you could use an ArrayList of ArrayLists:

ArrayList outerList = new ArrayList();
outerList.Add(n ew ArrayList());
outerList.Add(n ew ArrayList());

Now you can access outerList[0] and outerList[1] and add arbitrary
numbers of objects to them, or you can extend outerList. So the complete
construction is effectively dynamically resizable in two dimensions.

Depending on the needs of your data storage, you should definitely look
at other solutions, though - it would be better to use typed
collections, for example, and although there are points where a solution
like this is required, I wonder if a more tightly integrated data
management class wouldn't be a better solution.
Oliver Sturm
--
omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog
Nov 17 '05 #2

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

Similar topics

0
1042
by: tony barratt | last post by:
Hello, I am working on a python app which does quite a lot of database manipulation via berkeley db. An increase in performance would be welcome, although ait is pretty quick it just has a lot to do. Currently it runs on RH 8.0, FC2 or 3 coming. And it is installed from an (rpm python-2.2.1-17). It runs on a dual processor xeon. My experience with X leads me to believe you can get a performance increase of 10-20% from compiling it.
0
1166
by: dba_udb | last post by:
We have a requirement to increase DB2 catalog space on OS/390. As the underlying tablespaces and indexspaces are user-managed, is there a way to increase the space without taking an outage of DB2? Is ONLINE REORG with UNLOAD PAUSE a viable option? Thanks in advance for your response.
2
2148
by: Miguel Dias Moura | last post by:
Hello, I have a dataset (users) on an ASP.NET/VB page (detail.aspx). A record on this dataset (users) has 3 fields: "id", "username", "visits". The page detail.aspx is called with a variable value in the URL, such as: detail.aspx?user=john
8
2771
by: S. HP | last post by:
How can I make a build number that increases for each build automatically in a ASP.NET project, as I used to have in VB 6.0 ? Regards, SAHP
3
2377
by: Shapper | last post by:
Hello, I have a database table with 2 fields: and ; I need to create a function which increases by 1 the number in field for a certain id. In this moment I have the following: Private Sub Vote()
4
58458
by: =?Utf-8?B?c2FtZWVy?= | last post by:
environment : .net framework 1.1, ado.net, visual studio 2003, vb, sqlsever 2000, winforms, webforms I want to increase the timout of the webservice in the application which is being used in a huge number of places and this woudl take me forever if i do it indivisually, is there any way i can increase the timeout globally by something like specifying in the config file? thanks sameer
5
10283
by: BillE | last post by:
I am using VB.NET, VS 2005 Add a windows form and in design view: Add a Radiobutton to the windows form Set AutoSize = True for the radiobutton Set the MaximumSize width to 90 for the radiobutton Enter text for the radiobutton which is longer than the default Run it - the height of the radiobutton does not increase, and the text is truncated.
3
6125
by: remya1000 | last post by:
I’m using Vb.net application program. I created a datagrid having text field and checkbox fields. Everything is displaying correctly. I have 9 Columns and each columns are equally separated. In DataGrid property, I made PreferredColumnWidth = 85. So its equally aligned. I would like to give more width for the column named Department than rest of the columns. Because when its equally aligned, I can see the Departments displayed. Department...
4
4840
by: zoeb | last post by:
Hi. I have a form which the user enters 2 years worth of data into (one record per year). The aim, is to populate the table this form is based on with 3 more years worth of data (i.e. creating 3 new records), based on a percentage increase on the previous year. This form is based directly on a table called tblBudgetShareProj. So far I have the following code but I am COMPLETELY new to VB and I'm very aware of how incomplete it is. I have a...
8
2711
by: Guy Macon | last post by:
How to increase web server uptime with DNS failover: For illustration, let's start with some really bad hosting... Find four free web hosts that are each 90% reliable -- in other words they each are down on average one day out of ten. Use a failover DNS system with monitoring to switch servers if one fails. On average: One server will be down one day out of ten
0
8180
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
8623
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8576
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7091
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
5538
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
4050
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
4121
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2566
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
0
1423
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.