Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Simple problem using for loop/array?

  • 15-12-2007 01:05PM
    #1
    Registered Users, Registered Users 2 Posts: 6,537 ✭✭✭


    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, Registered Users 2 Posts: 981 ✭✭✭fasty


    txtBoxDisplay.Text += vals;


Advertisement