|
-
Apr 22nd, 2002, 06:19 PM
#1
Thread Starter
New Member
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?
-
Apr 22nd, 2002, 06:22 PM
#2
Someone has previously posted that answer... I'll search.
-
Apr 22nd, 2002, 06:36 PM
#3
Hyperactive Member
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.
-
Apr 22nd, 2002, 06:39 PM
#4
Maybe:
VB Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
Static sbuff As String
sbuff = sbuff & Chr(KeyAscii)
If Len(sbuff) = 5 Then Text1.Text = vbCrLf & Text1.Text & sbuff: sbuff = ""
End Sub
-
Apr 22nd, 2002, 06:43 PM
#5
Hyperactive Member
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.
-
Apr 22nd, 2002, 06:49 PM
#6
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)?
-
Apr 22nd, 2002, 10:13 PM
#7
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|