I'm tasked with having a button that will set a value entered to an array. The user will enter a value press the button, once the button is pressed the value the user entered is stored into an array. My teacher (yes this is a homework question) said that he wants it to do only one value at a time.
The problem i'm running into is, I just don't know what to write in order for this to happen. I've tried looking at what all I can do in the event but that has gotten me nowhere, unless the answer was there and I just completely missed it.
Any suggestions on where to look, or an idea of what to write would be awesome.
private void addToArray_Click(object sender, EventArgs e)
{
Button bclick = (Button) sender;
string variables = addArrayTextBox.Text;
int []vars = new int[5];
vars = parseVariableString(variables);
int numberIndex = 0;
for (int i = 0; i < vars.Length; i++)
{
int indexNumber = vars.Length;
numberIndex = indexNumber;
}
integerTextBox.Text = numberIndex.ToString();
}
Is what I currently have typed up.
parseVariableString()do?