How do i output an array to a Textbox?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wixxel
    New Member
    • Jun 2009
    • 2

    How do i output an array to a Textbox?

    Let my apologize upfront, i'm very new to C#. I have an array i want to iterate and output it to a textbox. Is a textbox the ideal control for the output of my array? If yes, any suggestion would be helpful.
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    A listbox might be better.
    A listbox has a property called 'items'. Each item becomes it's own 'line' if you will. It can be clicked on seperatly etc.

    Code:
    String[] YogiArray = {"Picnic", "Basket", "Ranger", "Smith"}
    foreach (string Booboo in YogiArray)
    {
        MyListBox.Items.Add(Booboo);
    }

    Comment

    • Wixxel
      New Member
      • Jun 2009
      • 2

      #3
      Thank you. I appreciate all your help.

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        And later if you use lists instead of arrays you should be able to bind your list 'directly' to the control.

        Comment

        Working...