|
-
March 24th, 2010, 10:32 PM
#1
How to: create a array with undetermined length?
hi guys!
i'm trying to make a app on Visual Studio but i have a question ...
I want to create a window in which the user enters a value and he can press two buttons: In one, ends action and other keep asking for the user insert more values.
My only problem is that I need to create an array with unspecified size to go for storing whatever how much data the User you want to add.
var data_x = new int[quanti_dados];
var data_y = new int[quanti_dados];
var times = 0;
quanti_simu = Convert.ToInt32(textBoxSimulacoes.Text);
do
{
var textodados1 = "Digite o primeiro dado para a " + (times + 1) + "ª coluna.";
var textodados2 = "Digite o segundo dado para a " + (times + 1) + "ª coluna.";
var formdados = new Dados();
formdados.labelInserirDadosX.Text = textodados1;
formdados.labelInserirDadosY.Text = textodados2;
formdados.ShowDialog(this);
dados_x[times] = Convert.ToInt32(formdados.textBoxInserirDadosX.Text);
dados_y[times] = Convert.ToInt32(formdados.textBoxInserirDadosY.Text);
}while (DialogResult == DialogResult.OK);
I want the variables data_Y and data_X to have an indefinite or infinite size, so I can go adding values to without have to declare its size.
thanks a lot all of u
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|