473,385 Members | 1,927 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,385 software developers and data experts.

Multidimension Array in C# Windows Form

Hi,

I have a 2 dimension string array MyArray, how do I know the Count of the
Rows and Columns in the MyArray?
Thanks for help.
Jason
Jan 19 '06 #1
5 4507
is it a staggered array or a rectangular array?
By this, I mean, have you declared it as:

string[][] MyArray (staggered)
or
string[,] MyArray (rectangular)

Jan 19 '06 #2
Thanks Steven,
I declare it as string[ , ] GoodString;
"Steven Nagy" <le*********@hotmail.com>
???????:11**********************@g49g2000cwa.googl egroups.com...
is it a staggered array or a rectangular array?
By this, I mean, have you declared it as:

string[][] MyArray (staggered)
or
string[,] MyArray (rectangular)

Jan 19 '06 #3
Jason Huang wrote:
Thanks Steven,
I declare it as string[ , ] GoodString;


In that case use GoodString.GetUpperBound(0) to get the upper bound for
the first dimension, and GoodString.GetUpperBound(1) to get the upper
bound for the second dimension.

Jon

Jan 19 '06 #4
Yes, as Jon suggests...

string[ , ] GoodString;
....
int count = GoodString.GetUpperBound(0) * GoodString.GetUpperBound(1);

Jan 19 '06 #5
Steven Nagy <le*********@hotmail.com> wrote:
Yes, as Jon suggests...

string[ , ] GoodString;
...
int count = GoodString.GetUpperBound(0) * GoodString.GetUpperBound(1);


To get the total size is easier than that - just use GoodString.Length.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 19 '06 #6

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

Similar topics

15
by: Geoff Cox | last post by:
Hello, Can I separately declare and initialize a string array? How and where would I do it in the code below? It was created using Visual C++ 2005 Express Beta 2 ... In C# I would have ...
11
by: Geoff Cox | last post by:
Hello, I am trying to get a grip on where to place the initialization of two arrays in the code below which was created using Visual C++ 2005 Express Beta 2... private: static array<String^>^...
1
by: Manny Chohan | last post by:
Can someone help me with the code to bind 2 dimensional array to datgrid? I just dont know how this can be done. Theres no code on the internet. Manny
11
by: Zorpiedoman | last post by:
The problem is this: I have a list box. I set an array list as the datasource. I remove an item from the array list. I set the listbox datasource to nothing. I set the listbox datasource to...
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
4
by: Charles | last post by:
Hello Everyone, I have been gettting great feedback from microsoft.public.vc.language group but after doing more searching I think my post should be directed to this group. I am trying to make...
29
by: foker | last post by:
I have this problem where I have 2 text files, one with student name, id#, # of courses and course #, the second file has course name and course number. I want to make a multidimensional array that...
0
by: srinivasreddypn | last post by:
Hello everybody, I know its a very simple problem to you, As a learner of flash action script m confused with the syntax of actionscript. Please let me know how to do this. Code: open close...
3
by: David K in San Jose | last post by:
I'm using managed (CLR) C++ in VS2005 to create a Windows app that contains a form named "MyForm". In the code for that form I'm trying to invoke some static functions by using an array of function...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.