Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. multiline txtbox

multiline txtbox

Scheduled Pinned Locked Moved Visual Basic
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nadroj
    wrote on last edited by
    #1

    how would i go about retrieving input from a multiline text box? the task i want to do is to get the data on each line of the box, line by line. i want each line entry to be saved into other labels, or variables, or anything. i thought of using a for/next loop to check each individual chr of the box until a ascii(10) or ascii(13) chr is reached. these are, i think, the CR and LF characters which determine a new line and end of line. theres gotta b a better way? Thank you ------------------------ Jordan. III

    D 1 Reply Last reply
    0
    • N Nadroj

      how would i go about retrieving input from a multiline text box? the task i want to do is to get the data on each line of the box, line by line. i want each line entry to be saved into other labels, or variables, or anything. i thought of using a for/next loop to check each individual chr of the box until a ascii(10) or ascii(13) chr is reached. these are, i think, the CR and LF characters which determine a new line and end of line. theres gotta b a better way? Thank you ------------------------ Jordan. III

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      If your using a single multiline textbox to get input for multiple fields, you really should reconsider your input method. Using a single textbox makes input validation a bit of a chore. On the other hand, why not use the Lines() property of the TextBox? It returns an Array of Strings, one array item per line. RageInTheMachine9532

      N 1 Reply Last reply
      0
      • D Dave Kreskowiak

        If your using a single multiline textbox to get input for multiple fields, you really should reconsider your input method. Using a single textbox makes input validation a bit of a chore. On the other hand, why not use the Lines() property of the TextBox? It returns an Array of Strings, one array item per line. RageInTheMachine9532

        N Offline
        N Offline
        Nadroj
        wrote on last edited by
        #3

        hmm.. i nvr used that line() property before, ill chk it out, thanks. however, since the site was down last nite, i had nothing to do but test my elaborate theory. i got it to work. i had to save each line from the txtbox (up to 4 lines) to 4 different textboxes (singlelined). here is how i did it: For i = 1 To textLarge.TextLength If Mid(textLarge.Text, i, 1) = Chr(13) Then labelNum += 1 i += 1 Else If labelNum = 1 Then text1.Text &= Mid(textLarge.Text, i, 1) End If If labelNum = 2 Then text2.Text &= Mid(textLarge.Text, i, 1) End If If labelNum = 3 Then text3.Text &= Mid(textLarge.Text, i, 1) End If If labelNum = 4 Then text4.Text &= Mid(textLarge.Text, i, 1) End If End If Next i could have made it more efficient by using an array of txtboxes instead of 4, so i could reuse the code, but, hey... ------------------------ Jordan. III

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups