|
-
Oct 17th, 2005, 04:58 AM
#1
Thread Starter
Hyperactive Member
multi line testing
I have an application where the user types text into a multiline text box and it is added to a list box.
One major problem is that if the user types more than can fit in the list box, the text just continues off the end of the list box.
Is there a way i can write each line of the text box to a seperate line in the list box??
Cheers
GTJ
-
Oct 17th, 2005, 05:34 AM
#2
Re: multi line testing
May I ask the purpose for writing the text to a listbox?
-
Oct 17th, 2005, 10:47 AM
#3
Thread Starter
Hyperactive Member
Re: multi line testing
to show history of what they have typed..... but can you help with the problem???
-
Oct 17th, 2005, 10:50 AM
#4
PowerPoster
Re: multi line testing
Why not just add a scroll bar to the list box?
-
Oct 17th, 2005, 10:53 AM
#5
Thread Starter
Hyperactive Member
Re: multi line testing
you can't add a horizontal scrollbar?? it also looks neater to have a new line per new line in the text box...
-
Oct 17th, 2005, 10:58 AM
#6
PowerPoster
Re: multi line testing
You could add the line to the list box each time the user enters a carriage return (vbcrlf) and clear the text box for the next line.
-
Oct 17th, 2005, 10:59 AM
#7
Thread Starter
Hyperactive Member
Re: multi line testing
yes, but a text box automatically starts a new line when the user reaches the right side??
-
Oct 17th, 2005, 10:59 AM
#8
Re: multi line testing
VB Code:
Private Sub Command1_Click()
Dim nLimit As Long, s As String
nLimit = 50 '<-- change this as per the width of your listbox
s = Text1.Text
Do While s <> ""
List1.AddItem Left(s, nLimit)
s = Mid(s, nLimit + 1)
Loop
End Sub
-
Oct 17th, 2005, 11:02 AM
#9
Re: multi line testing
 Originally Posted by Pasvorto
You could add the line to the list box each time the user enters a carriage return (vbcrlf) and clear the text box for the next line.
What if the user never presses Enter key but types a very long sentence? (assuming only vertical scroll bar is enabled)
-
Oct 17th, 2005, 11:23 AM
#10
Re: multi line testing
You could use the .ToolTipText to display the field when they click on a listitem.
-
Oct 17th, 2005, 11:27 AM
#11
PowerPoster
Re: multi line testing
Add each keystoke to the listbox as it as typed into the text box...
-
Oct 17th, 2005, 11:30 AM
#12
Thread Starter
Hyperactive Member
Re: multi line testing
how would that help my problem?? the keys would still be entered off the edge of the list box...
-
Oct 17th, 2005, 11:32 AM
#13
PowerPoster
Re: multi line testing
I like the earlier thought. Store the keystrokes in a variable until they meet your line limit. Then add them to the listbox and clear the variable to receive new data.
-
Oct 17th, 2005, 11:34 AM
#14
Thread Starter
Hyperactive Member
Re: multi line testing
ok cool i will try Pradeep1210's method
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
|