Results 1 to 7 of 7

Thread: Question about working with textboxes...

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    4

    Question Question about working with textboxes...

    Okay, in my dinky little program I have a textbox that I plan on typing long things into. I have it set to multiline and vertical scrollbars.

    Now when the program is running and I type long things into it, it appears to skip down to the next line when the text I'm inputting hits the edge of the textbox, but when I use the txtText1.Text of the textbox for displaying the text, only the lines that I manually start (ie, by hitting enter and forcing it to skip down a line) show up as new lines (ie, the rest are all one really really really long line). Is there a way to set a column width so that it automatically starts new lines when the user has typed a certain amount?

  2. #2
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    Someone has previously posted that answer... I'll search.

  3. #3
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349
    It is the word wrap feature. What is happening is that your text box cannot fit the entire line you are typing on a single line so it wraps to the next line, obviously. When you type something into the box every key you press is stored, including tabs and enters. When you access the contents of the text box that is what you get - a stream of keys which are interpreted, so your new lines only occur when you pressed enter. Try this out by changing the width of the text box.
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

  4. #4
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    Maybe:
    VB Code:
    1. Private Sub Text1_KeyPress(KeyAscii As Integer)
    2.     Static sbuff As String
    3.     sbuff = sbuff & Chr(KeyAscii)
    4.     If Len(sbuff) = 5 Then Text1.Text = vbCrLf & Text1.Text & sbuff: sbuff = ""
    5. End Sub

  5. #5
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349
    I'd better learn to read all of the post. Sorry, not sure on that one.
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

  6. #6
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    Originally posted by Blinky Bill
    Sorry, not sure on that one. [/B]
    I have been unable to replicate the same problem too

    I just placed a TextBox on a form - Multiline to True, seems to
    work OK (with long strings)?

  7. #7

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    4
    I figured it out. I had been taking the text from the text box and putting it into another textbox, but on that other textbox, I had accidently set it to have both vertical AND horizontal scrollbars. Once I set it to just vertical bars it started wrapping the text like I'd wanted.

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