I'm completely new to Windows programming but I figured I would try to write some simple, beginning type program today. So I got this program that has an integer array with 3 elements in it, and I'm using a loop to populate the array with the numbers 0, 1, and 2.
Then I use another loop to show the numbers in a TextBox when I click the button. Problem is the only number that shows in the TextBox is 2.
I figure since 2 (the last valid value of the loop control variable) , that is the only value I see in the TextBox.
But the quotation marks meaning put a space after an integer is added should take care of that, but it isn't.
Here is what I got:
private void button1_Click(object sender, EventArgs e)
{
int[] numbers = new int[3];
int t;
for (t = 0; t < 3; t++)
numbers[t] = t;
for (t = 0; t < 3; t++)
textBox1.Text = numbers[t] + " ";
}
Then I use another loop to show the numbers in a TextBox when I click the button. Problem is the only number that shows in the TextBox is 2.
I figure since 2 (the last valid value of the loop control variable) , that is the only value I see in the TextBox.
But the quotation marks meaning put a space after an integer is added should take care of that, but it isn't.
Here is what I got:
private void button1_Click(object sender, EventArgs e)
{
int[] numbers = new int[3];
int t;
for (t = 0; t < 3; t++)
numbers[t] = t;
for (t = 0; t < 3; t++)
textBox1.Text = numbers[t] + " ";
}