Textbox linewrap with vbCrLf problem

G

gtslabs

I am trying to display some tab delimited data in a textbox.

The text box is not wide enough to see all the data.
I have a vbCrLf at the end of each record.

So my text box is being populated like this:
For I = 1 to alot
TB_output = TB_output & data1 & vbTab & data2 & ...... & vbCrLf
Next alot

I have scroll bars turned on and multiline = true
However it wraps data to the next line in the textbox before the
vbCrLf statement and at the vbCrLf.
The scroll bar is NOT displayed

If I turn multiline to False I get the scroll bars to appear but data
is all on one line and the vbcrlf is displayed as a character.

How do I see multiline data and horizontal scroll bars using vbCrLf

I may have too many lines to put into a list box. Plus I want the
option to copy and paste data easily in the future
 
O

OssieMac

Untested: In the Text box properties try setting the EnterKeyBehaviour to
True. This is the property that allows the use of the enter key for the next
line when entering text manually.
 
P

Peter T

If I follow, you want the right edge of the multiline brak to the right of
the visible width of the text box. Seems to defeat what MultiLine provides,
but here are a couple of ideas for what I think you might be after -

1.
Place your line-breaks where you want the (use vbLf rather than vbCrLF)
MultiLine = True and WordWrap = False

2
Set the width of the Textbox to the overall width you want to scroll to (ie
wider than you want it to appear on the form)
MultiLine = True, WordWrap = true
Size a Frame to the visible size you want for your textbox, a little taller
to allow for the H-scroll.
Remove the frame's caption
Cut the Textxbox, select the frame, and paste into the frame. Position to
top-left corner of the frame.
Add the horizontal scrollbar to the frame and set its scrollwidth to that of
the width of the textbox (might need to adjust slightly), eg
With Me.Frame1
..TextBox1.Left = 0
..TextBox1.Top = 0
..ScrollWidth = .TextBox1.Width
End With

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top