H
Harold A. Mackey
I have a situation where a user must enter three int results into three textboxes, save that entry and enter another set. All sets have to be displayed in another box or grid, and when the collection of data is complete, the array of arrays must be saved.
I created an array and populated the elements:
string[] stat = new string[3];
stat[0] = txt1.Text.ToString();
stat[1] = txt2.Text.ToString();
stat[2] = txt3.Text.ToString();
And added this array to the arraylist:
stats.Add(new stat());
stats.Count tells me that I am adding another array to the list whenever I btn_Click
lblResults.Text ="The count is: " + stats.Count + "\n";
But I cannot iterate through the arraylist to see the results.
for( i=0; i!=stats.Count; i++)
{
string result = stats[0].ToString();
lblResults.Text += result + "\n";
}
The question, I think, is how do you unbox and array from an arraylist? Or is there a better way to do this? :>)
Many Thanks,
Harry
I created an array and populated the elements:
string[] stat = new string[3];
stat[0] = txt1.Text.ToString();
stat[1] = txt2.Text.ToString();
stat[2] = txt3.Text.ToString();
And added this array to the arraylist:
stats.Add(new stat());
stats.Count tells me that I am adding another array to the list whenever I btn_Click
lblResults.Text ="The count is: " + stats.Count + "\n";
But I cannot iterate through the arraylist to see the results.
for( i=0; i!=stats.Count; i++)
{
string result = stats[0].ToString();
lblResults.Text += result + "\n";
}
The question, I think, is how do you unbox and array from an arraylist? Or is there a better way to do this? :>)
Many Thanks,
Harry