Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Simple problem using for loop/array?

Options
  • 15-12-2007 2:05pm
    #1
    Registered Users Posts: 6,521 ✭✭✭


    Hey i was just going over a bit of web programming but i cant get this code to work.

    Its in C# doing a web site. What i have is a button and a text box so when i click the button it will display all values in the array.

    protected void Button1_Click(object sender, EventArgs e)
    {
    int [] vals={10,20,30,40,50};
    for (int i=0;i<6;i++)
    {

    txtBoxDisplay.Text = vals.ToString();
    }
    }
    thats my code but I just cant remember how to get the values to all display beside eachother in the text box when i click the button. What am I doing wrong?


Comments

  • Registered Users Posts: 981 ✭✭✭fasty


    txtBoxDisplay.Text += vals;


Advertisement