simple 1d Array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • insomnia
    New Member
    • Mar 2008
    • 11

    simple 1d Array

    How do i simply display the contents of my array in to a textbox on my GUI ??




    Code:
            Dim details As String() = {TextBox1.Text, TextBox2.Text}
    
            Dim list As New ArrayList()
            
    
            For Each detail As String In details
                list.Add(detail)
            Next detail
    cheers
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    A simple way is to bind the array to the list. HTH.

    Comment

    • SpecialKay
      New Member
      • Mar 2008
      • 109

      #3
      my VB is old but,
      could you not just:

      For array.size
      textbox.text += next array value

      in psudocode

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        I am confused here:
        [code=vbnet]
        'Here you create a 1D String Array from the contents of two textboxes.
        Dim details As String() = {TextBox1.Text, TextBox2.Text}

        'Here you create a new ArrayList()
        Dim list As New ArrayList()

        'Here you loop through your 1D String Array, placing the values into an ArrayList
        For Each detail As String In details
        list.Add(detail )
        Next detail
        'but for what end?
        [/code]

        Could you not just do this:
        [code=vbnet]
        Dim list As New ArrayList()

        list.Add(TextBo x1.Text)
        list.Add(TextBo x2.Text)
        [/code]

        What textbox are you wanting to show these values in?

        Comment

        • insomnia
          New Member
          • Mar 2008
          • 11

          #5
          Could you not just do this:
          [code=vbnet]
          Dim list As New ArrayList()

          list.Add(TextBo x1.Text)
          list.Add(TextBo x2.Text)
          [/code]

          What textbox are you wanting to show these values in?[/QUOTE]


          Yes i have now changed it :) much simpler I now want to display the whole array list in TextBox3.text for example.

          How do i display the contents of "list" in textbox3.text

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            Well how do you want to terminate from item from the next?

            For example you could just do this:
            [code=vbnet]
            textbox3.Text=t extbox1.Text & textbox2.Text
            [/code]

            Or with a newline:
            [code=vbnet]
            textbox3.Text=t extbox1.Text & "\r\n" & textbox2.Text
            [/code]


            But you are probably going to want to loop through your array and add them to the textbox.


            I think a basic tutorial on subject (google it and you will find it)

            Comment

            • insomnia
              New Member
              • Mar 2008
              • 11

              #7
              Originally posted by Plater

              I think a basic tutorial on subject (google it and you will find it)
              ok thanks alot, i will have a look around

              Comment

              Working...