Have a simple webpage that will take certain details from the visitor. The
form is controlled, so there won't be more than 6 fields, but of course, I
can't predict how many entries. I'd like to put these details into an array
(as it works nicely with the rest of the affected pages / site), but I've
gone over this many times now and I can't find a way to just go string
details[][6];. It always wants there to be a value in the first dimension
:(
What I've done in the declaration is : string[,] kartArray = new
string[3,6]; just to check that the page is working fine, but I want to
remove the '3' so that it's not limited to 3, but rather unlimited. Please
tell me this is possible. I've tried variations to this, but no matter
what, I need to specify the numbers. Any ideas on what I could do?
Thanks in advance :)
First, if you have a dynamic number of entries, you'll be much happier
with an ArrayList or Hashtable.
To answer your question, you have a two-dimension array, so in order
to access one of the 2nd dimensions, you must first tell it which
1st dimension you want.
If you had a table with unlimited rows and 2 columns, and you wanted
to reference column 2, which row should it grab column 2 from?
You should create a simple object with 6 properties representing
the 6 fields.
Then you should have an ArrayList. You create a new VisitorDetails
object (or whatever you call it), set the 6 properties from the
form fields, add them to the ArrayList and pass the ArrayList around.
> What I've done in the declaration is : string[,] kartArray = new
> string[3,6]; just to check that the page is working fine, but I want
to
> remove the '3' so that it's not limited to 3, but rather unlimited.
Please
> tell me this is possible. I've tried variations to this, but no
matter
> what, I need to specify the numbers. Any ideas on what I could do?
Arrays are fixed. Always. You can create a new array that's slightly
larger and then copy the elements from the original array to achieve
a "resize" of the array, but you can never actually change the original
array.
You should use ArrayList. It functions much like an unbounded Array.
-c
"Chad Myers" <cmy...@N0.SP.4M.austin.rr.com> wrote in message
news:neCE9.63984$8D.15...@twister.austin.rr.com...