dcsimg
Results 1 to 4 of 4

Thread: Seperator and reassembler

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2018
    Posts
    10

    Seperator and reassembler

    Hello, i am trying to make a application in which i take the numbers 1000 to 1025 and make one listbox that shows the number (1001,1002 etc), and another 4 list boxes that separates each digit from the whole number and one final list box that reassembles the 4 digits back together. how would i proceed?

    btw i am new to Visual Studio and still learning to code with it.
    Last edited by Jinzo4809; Jan 13th, 2019 at 03:18 PM.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    22,189

    Re: Seperator and reassembler

    Try this...

    Name:  13-01-2019 20.17.40.jpg
Views: 35
Size:  17.5 KB

    Code:
    Public Class Form1
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            For x As Integer = 1000 To 1025
                TextBox1.AppendText(x.ToString & Environment.NewLine)
                Dim chars() As Char = x.ToString.ToCharArray
                TextBox2.AppendText(chars(0).ToString & Environment.NewLine)
                TextBox3.AppendText(chars(1).ToString & Environment.NewLine)
                TextBox4.AppendText(chars(2).ToString & Environment.NewLine)
                TextBox5.AppendText(chars(3).ToString & Environment.NewLine)
                TextBox6.AppendText(String.Concat(chars) & Environment.NewLine)
            Next
        End Sub
    
    End Class

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    22,189

    Re: Seperator and reassembler

    For ListBoxes, which are not what you originally specified, instead of...

    Code:
    TextBox1.AppendText(x.ToString & Environment.NewLine)
    Use...

    Code:
    ListBox1.Items.Add(x.ToString)

  4. #4

    Thread Starter
    New Member
    Join Date
    Dec 2018
    Posts
    10

    Re: Seperator and reassembler

    Thank you for your help. Your solution is clear and simple.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width