Results 1 to 9 of 9

Thread: [RESOLVED] i want to split textbox to smaller textboxes

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2014
    Posts
    4

    Resolved [RESOLVED] i want to split textbox to smaller textboxes

    hi,
    i want split textbox to other textboxes...
    how can i do this?
    i have a picture to show what i mean exacktly..

    here: i want to split the textbox1.text to other textboxes below like the picture..

    Name:  splitter.jpg
Views: 223
Size:  18.6 KB
    i dont know the code for split button..
    can you help please?
    thanks.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: i want to split textbox to smaller textboxes

    The TextBox itself is actually irrelevant. The Text property of any control is a String and splitting any String on delimiters means using the String.Split method.

    I'm not going to provide an example because there are loads around. Learning how to find relevant information once you've been told what type and or member to use is the first step to moving from being a beginner to an intermediate developer.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: i want to split textbox to smaller textboxes

    If you think you know what to do but it doesn;t work, by all means post back and show us what you've done and tell us what happened and I'll be glad to help further. I'm keen to see an attempt first though, now that you know what you need to use.

  4. #4
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: i want to split textbox to smaller textboxes

    Use string split for that requirement.

    Code:
    Dim combination As String
    Dim combinations() As String
    combination = "10962-10532-33154"
    combinations = combination.Split(New Char() {"-"c})
    TextBox1.Text = combinations(0)
    TextBox2.Text = combinations(1)
    TextBox3.Text = combinations(2)
    KGC
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: i want to split textbox to smaller textboxes

    Quote Originally Posted by KGComputers View Post
    Use string split for that requirement.

    Code:
    Dim combination As String
    Dim combinations() As String
    combination = "10962-10532-33154"
    combinations = combination.Split(New Char() {"-"c})
    TextBox1.Text = combinations(0)
    TextBox2.Text = combinations(1)
    TextBox3.Text = combinations(2)
    KGC
    That overload of String.Split actually has its `separator` parameter declared as a ParamArray. That means that there's no need to actually create an array yourself. You simply pass zero, one or more discrete values and they get combined into an array implicitly. Zero arguments means split on whitespace characters, e.g. spaces and tabs, while one or more arguments means split on any matching characters.

  6. #6
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: i want to split textbox to smaller textboxes

    Oh, thanks for pointing it out..
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2014
    Posts
    4

    Re: i want to split textbox to smaller textboxes

    Thanks a lot of you for help
    its working.
    my topic is resolved

  8. #8
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: i want to split textbox to smaller textboxes

    Don't forget to mark this thread as resolved.

    KGC
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  9. #9

    Thread Starter
    New Member
    Join Date
    Feb 2014
    Posts
    4

    Re: i want to split textbox to smaller textboxes

    ok

Posting Permissions

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



Click Here to Expand Forum to Full Width