variables

  • Thread starter Thread starter RobcPettit
  • Start date Start date
R

RobcPettit

Hi, Is it possible to declare multiple arrays of the same name. Eg if
I tracking share prices and I use a array STOCKPRICE. Im adding a new
tabpage for each stock I want to follow. So today I follow ony one so
I use STOCKPRICE. Next day I want to follow 3 so I want to use
STOCKPRICE, STOCKPRICE(2) AND STOCKPRICE(3). What Im doing is before
starting Im adding the number of tab pages needed with usercontrols,
then looping through the stocks, updating the arrays, then adding the
details to the relevant tabs. Using the stockname as the tags for the
controls. If I want to select different numbers of stocks each day, I
thought there may be a way to add arrays dynamically. In vba excel I
deed use something like int qwert(1 to 10). Is this possible in c#.
Regards Robert
 
Hi, Is it possible to declare multiple arrays of the same name.

Why not just have an array of arrays? Or, since you are adding new arrays
on some regular interval (daily?) a List<> of arrays?

Pete
 
Thankyou for your reply, to both my posts now. I hadnt heard of array
of arrays, so I will have to do some reading. Of the top of my head
though, am I right in thinking I can create these at runtime, then add
the arrays(within the array of) in the normal way?
Regars Robert
 
Thankyou for your reply, to both my posts now. I hadnt heard of array
of arrays, so I will have to do some reading. Of the top of my head
though, am I right in thinking I can create these at runtime, then add
the arrays(within the array of) in the normal way?

Well, arrays always have a fixed size (specified at creation time).
If you want to add dynamically, you'd be better off using ArrayList
(.NET 1.1) or List<T> (.NET 2+)

Jon
 
Back
Top