Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Text Box And Word Wrap?


I'm creating a generic notepad and I'd like to have the contents word wrap(I only want to use a vertical scrolbar), anyone know how to accomplish this? Also how do I resize the text box when the form resizes?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Text Box Word Wrap??
When I create a text box thru a macro, how can I make it automatically Word Wrap??

Thanks in advance,

Text Box Word Wrap
I'm working on a personal project of seeing with what i know I can make a word processing program. For now I've ran onto the following road blocks:

1) I was wondering how to make it so if you got to a certain number of Twips, in a text box, make it go down a line (vbCrLf).

    I have a vague idea on how to make this possible, but that would need a way to find out how many Twips were inputed already, and I have no idea on how to do that.
---------------------------------------------------------------------
2) Also, I was wondering how to make it so if u press a certain key then it does something.
   Ex: Pressing the [Enter] Key makes it go down a line.

Thanks for any help you may give me.

Non-word Wrap In Rich Text Box?
I'm sorry, I'm new to using rich text boxes, but, as I'm going to be competing in the VBPad coding contest, I need to know. How do I make my rich text box not use word wrap? I tried giving it scrollbars of Both, but it still wordwraps. Any way to fix this?

Make A Text Box Have Word Wrap
Is there a way to make text boxes word wrap by themselves?

Word Wrap A Text Box :confused:
i'm sure i saw an option to wordwrap a textbox somewhere
like text1.wrap = true
or something very simple like that

i just don't know what it is...


help!

Word Wrap To A Text File
I need code to wrap data from a database field into a text file. I can do short fields just fine but the long ones need wrapped.

the code i have will appear to wrap ok when viewing with Wordpad, Notepad or on Email attachments but when printed it is broken up into funny sections.

I heard that the API can do this.

ANY info on where i can get info on printing would be a big help also. printing seems to be tricky with VB6.

can someone help me?

Ron

Word Wrap In Multi-Line Text Box
Does anyone have a procedure that would "word wrap" (as in notepad) some text? I was thinking of using Len(), and then inserting a vbCrlF after a certain amount of characters, but the problem is that there can be more "i's" on a line then "a's".

Help With Word Wrap In A Text Box Bound To A MS Access DB
I have a VB program that uses an Access database.  On one of the forms I have a text box that the user inputs a description of about 150 characters or less.  The problem is that when they enter the characters they only get one line and when the view the record the text in the text box is then cut off and only shows the first line. Can someone give me an example of code that I could use to get the text to wrap to the next viewable line in the text box.

Any help would be greatly appreciated.

Thanks,

-Richard

MultiLine Text Box And Word Wrap After 30 Characters
I need to be able to have the word wrap kick in after 30 characters are input. Can someone help me out? Thanks, Jeremy

Knowledge is the most powerful tool a person can obtain.

DeveloperKB

Printing Multiple Text Boxes With Word Wrap?
Hello everyone
Ive been working on this for a while now and ive had no luck. Im going to try to explain what i want to do to make it easier to help so bear with me please. Thanks. I want to print 6 text boxes in order on the printer with the printer dilog so the user can select a printer and such. The only problem is the text boxes have to be word wrapped (when printing) and I cant seem to figure out how to get 6 text boxes with word wrap to look good. Ive tried microsofts thread on richtextboxes but it will only print one box. This is what i have right now

On Error GoTo HellandBack



With CommonDialog1
.CancelError = True
.ShowPrinter

Printer.FontSize = 16
Printer.FontBold = True
Printer.Print "NAME:"
Printer.FontBold = False
Printer.Print nametxt.Text

Printer.Print ""

Printer.FontBold = True
Printer.Print "DATE:"
Printer.FontBold = False
Printer.Print datetxt.Text

Printer.Print ""

Printer.FontBold = True
Printer.Print Label5
Printer.FontBold = False
PrintRTF RichTextBox1, AnInch, AnInch, AnInch, AnInch

Printer.FontBold = True
Printer.Print Label6
Printer.FontBold = False
PrintRTF RichTextBox2, AnInch, AnInch, AnInch, AnInch

End With

Printer.EndDoc

HellandBack:
If Err.Number = cdlCancel Then Printer.KillDoc 'checks that the error was the one from the print dialog, then kills it


End Sub




Thanks so very much for any help as this is a school project and I need it tomorrow!

Adding A Carriage Return To A Text Box That Does Not Offer Word Wrap
Hi all

I am working in a programs customizer module in order to add some stuff to a form. The text box that i have does not offer a word wrap feature(for whatever reason) and the text can get quite lengthy. So what I am wanting to try is to place a carriage return in there to see if i can bust up the text and keep it all nice and neat with out scrolling to the ends of the earth within the text box.

Heres the code directly from their own help files

Code:
Dim rs As Object
Dim sdata As String

set rs = MyDatabase.OpenRowset("select * from tapVendPurchHist", 10, kOptionNone)

sdata = rs.Clip
While rs.MoveNext > = 10
sdata = rs.Clip
Wend
rs.Close



So yea, I thought that would work but when I save the script i get a syntax error for this line:


Code:
While rs.MoveNext > = 10


and then a property not supported error from this line:


Code:
sdata = rs.Clip


Is there another way to write this so that these errors are not coming up? Or is there something that may be missing from this?

Thanks
tibor

Word Wrap
I am sorta designing something close to Notepad.

But the richtextbox wraps word automatically.

How can i tell the RickTextBox not to wrap text automatically?

I want to provide the user with a choice to "Wrap" or "Not Wrap" text just as in notepad

How Do I Word Wrap In VB 6?
Isn't there a one line code.... WordWrap = True

but that doesn't work. is there another way avoiding as much code as possible?

Word Wrap
How do you get word wrap to work on a label... so text doesnt go off the edge with just one line. i have word wrap set to true
HEEEEEEEEEEEEEEEEEEEEEEEELP!!!!!!!!!!!

Word Wrap
i need code to wrap text to a text file. the one i have looks ok on notepad, wordpad or an emailed file but when it is printed it is all broken up.

i use this method to create a page of data from a database for viewing or printing. the only problem i have is with long strings. i can load the shorter strings with no problem.

this method is a handy tool for my programs if i can just get this problem fixed.

if you need more info, please let me know.

can somone help me out?

Ron

Word Wrap
hi guys can you help me with RTB? its my first time to use RTB. i am trying to load a text file in RTB the using this code


Quote:




RTB.LoadFile App.Path & "x.txt"




now i wanted RTB to display it as it is just like a multiline textbox, but it wraps the loaded file just like word wrap in notepad, i enabled the scrollbars on both so it will display as is but still it wont do.. am i missing something?

Word Wrap Help
I was told in a previous post that a way make word wrap is by using rich text text boxes. How exactly would I go about doing that? (NOTE: I do know how to get rich text boxes onto my form, how do manipulate them for word wrap?)

And if not with rich text, then how else?

Any suggestions are appreciated, please state how to do it in some detail, not too vague.

Word Wrap
hey, im writing a copy of notepad to further my skills with vb. In the menu there is a checked word wrap option, when this is checked, there is only a vertcal scrollbar, when unchecked there are both scrollbars. i tried to acheive this but it sais that the scrollbars were read only during runtime, is there any way to get around this or is there another way of doing it?, thanks allot for any help i receive

matrixhacker

Word Wrap ....HELP
Hi,
can somebody tell me how to disable text box word wrap?
thank you...

RTB Word Wrap
How do I enable / disable word wrap in a richtextbox?

Word Wrap
Good afternoon.

I have a little problem. I want to create a line length (based on character count) rather than a line width (based on pixel count) word wrapping routine.

The routine itself is fairly easy, and by the looks of most of your posts here, you guys would be able to knock one up in no time at all.

However, how would you deal with people entering in their own vbCrLf's? Any word wrap routine needs to leave the user entered ones alone, but delete it's own one. I suppose what I'm asking is is there a recognised method of dealing with paragraphing and user formatting without upsetting a word wrap routine?

Is this a situation that I have to create my own control in order to achieve this? Am I expecting a textbox to do to much?

Word Wrap
How to set the Word Wrap of RichTextBox control to False?

Word Wrap In RTB?
Um, i set my RTB to multile = True, and vertical scrollbar at design time. What i need is to word wrap it, so it removes the vertical scrollbar and places the horizontal one. Problem is it errors "Property is read only" which i take means you can only set the properties at design time. Is there a way around this?

Thanks

Word Wrap
hi friends,
how to wrap the text . i know i can do it just but setting the wordwrap property to true but i don't wanna do that i want to do it programmatically b'coz i have to add few spaces at the beginnng of every line that is wrapped.

OR

just give me a solution to add spaces at the start of every line in a richtext box control where the text is wrapped.

thanx,

No Word Wrap In The RTB
I've tried setting the scroll bars to 3 (both) and all I get is the vertical. I've tried DisableNoScroll as both true and false and I've tried tweaking the RightMargin to no avail.

How do I get rid of the Word Wrap feature in my RichTextBox???

Word Wrap
Help. I am a beginner VB programmer and I need to know how to make my text wrap when I type into a text box intead of just continuing on one line. Also I need to how to print from my text box so that it wraps too.

Word Wrap
Hi Everyone,

How can I print text using the Printer.Print object so that the text will wrap to the next line without cutting off words? I know I should use the Printer.CurrentX and Printer.CurrentY properties but I am not sure how to do this. Any help would be appreciated. thanks.

Word Wrap
what give's with the word wrap on this forum..times it
wraps fine and other times the words are two screens wide.
My system or a problem with the wrap????

Word Wrap
Hi!

I'm doing this User Control called Colored Label -- it's a regular label, but you can modify the colors in it. First, initialize the colors you wanna use using this function:

ColoredLabel1.SetColor AscW("G"), RGB(0, 255, 0)

This will initialize the G as Green (any color not initialized will stay as black). Now, to use this color, in the middle of the text in the Caption property, you type a special character (defined in the ColorModifier property) and the character in front of it will modify the color to the one defined for it (for example, "Testing #GGreen #0Testing" will display "Testing" in the default color, then "Green" in green and "Testing" in black, since 0 was not initialized).

So, it was going fine until it came the time to word wrap (use multiple lines). This is the only clue I have, but I can't put it to work:

1. Write the characters 1 by 1.
2. When the total width acheived in the text is bigger than the width of the User Control, erase the previous letters 1 by 1 (also decreasing the counter if used in a For Next loop), until a Space character is found.
3. Then, increase the distance from the top to te start of the text (a variable).
4. Continue the loop until all characters are done.

Well, that's it. If you think it's not enough, I can send you the source code (please don't do anything bad with it, like solving the problem and saying it's yours!).

Thanks for your help!

Word Wrap In Word Processor
This really should be as easy as it seems...

I need to have a word wrap option in my word processing program and i have it on a drop down menu. What code would I associate with that menu button.

would it be:

txtbox.multiline = true To allow word wrap
txtbox.multiline = false To disable it

For some reason, this code does not work for me and tells me that "it can't assign to read only property"

any suggestions as to why it wouldnt let me change a property that can be changed at any time, not only runtime?

a peice of sample code would be nice

thanks in advance

Word Wrap In A Listbox
I researched this and found this question asked on this board, but none of the threads really had answers. Here's the problem: I have a listbox with a number of strings that are too long to fit in the listbox in one line. Typically, in this situation, the listbox only shows whatever fits. I need to have these long strings wrap to the next line, and the next line if necessary, etc. I don't want to simply split up the longer strings into several smaller strings and then additem each smaller string onto the list, because in that case each smaller portion of the string would be individually-selectable. I don't want that. I need for the entire long string to remain internally as one item so that the entire string will become selected when the user clicks on any part of it. Also I want Listbox1.text to equal the entire long string, and not just the smaller part that was clicked on.

I hope that made sense. Thanks in advance.

Word Wrap On A Label?
I have a label which I'm displaying as if it's a textbox. The text however always does a Word Wrap if it doesn't fit in the label. I have tried setting label.WordWrap property to both true and false but I still get the same result.

Is there any way to turn the Word Wrap off?

- Eric

End Of Word Wrap Error
I have written vba Word2000 macros to input and format test questions. At over 50 questions the last character in a question stem line may not show or print (but is there). I can inspect and manually move the table edge to show the character in the document. (No problem on hour tests, but on the final some 5 lines were in error.)

Is it wrong to make large documents? Is there a way of segmenting a document so the entire document is not affected when one question is formatted?

I have tried using subdocuments, but I get a tables cannot be saved in subdocument errror.

Any help will be appreciated.

Word Wrap On A Listbox?
Is there a way to word wrap a listbox?

I have a string (approx. 500 char) that I would like to display in a column in a listbox, but I have limited room for this column.

Any suggestions?

-Jeff

Word Wrap To Printer
Hello all,
I want to print multiple line text using the printer object to the full width of the printable area from a given CurrentyY, but as the lines don't wrap automatically, I wonder if any can help me with some code to achieve the necessary wrapping, I have found a number of similiar examples on the net which I'll continue to try but they are a little beyond me at this stage and are more than I need for my simple 1 page output.

thanks,

Phill

Word Wrap To Printer
I am writing a routine to accept several multi-line input fields and print them on various parts of a page. I am generating the HP commands within my program, and they do not offer any word wrap function. So the word wrapping has to be accomplished before I send the data to the printer. Any ideas on how to do this?

I wanted to simply build the form as it would appear on the hard copy, with multiline text boxes, and the appropriate font for each. However, I can not find a way to retrieve the textbox text data one line at a time.

Thanks for any suggestions!!

Word Wrap A String?
I have a string like this:

"...then a ghost will fly out the back of the house and drop the ball into the hole. On the lighthouse hole hit the ball towards the seagull. It should pick it up and drop it in the hole. On the jungle ruins hole hit the ball towards the bird at..."

As you can see, it's very long. I need to split it up, say, every 115 characters and insert a vbLf at the 115 characters mark. for Example:

"first 115 characters of string here" & vbLf & "next 115 characters here" & vblf & "next 115 character here"

Etc. Does anybody have an idea of how to do this? The string is of no fixed length, so this needs to work regardless of how long or short the string is...

Thanks for any help, I'm completely blank about how to do this..!

Word Wrap W/ A Scroll Bar
When you set a text box to multi-line and add a vertical scroll bar, the word wrap function stops working. It just splits the word between 2 lines when you hit the edge of the text box.

At first I figured that text boxes never word-wrapped, I didn't give it a second thought and I wrote a little sub to do the wrapping for me. Then I realized that other text boxes did word-wrap and I isolated the problem to a vertical scrollbar. I can recreate this over and over, so it's not a bug in my implementation.

Anyway, since I already have the sub written (It's actually a Sub and a Property) so it's not a big deal, but is there something that I'm missing--is there an "official" fix for this problem?

Word-wrap In Printing?
Is there any simple way to do word-wrapping using Printer.Print? When I tried to print a string that was longer than the width of the page, it did not go to the next line. I ended up writing a relatively long and complicated code to word-wrap it, but I wanted to know if there was a simpler way to do it? This is what I have: (strWholeText is the string to be printed)


Code:
intWhere2 = InStr(1, strWholeText, vbCr)
If intWhere2 = 0 Then
intWhere2 = Len(strWholeText) + 1
End If
intWhere = 1
While intWhere < Len(strWholeText)
strText = Mid(strWholeText, intWhere, intWhere2 - intWhere)
If Len(strText) < 85 Then
Printer.Print strText;
Else
intCount = 1
While intCount < Len(strText)
strText2 = Mid(strText, intCount, 85)
intWhere3 = InStr(intCount + 85, strText, " ")
intEndLine = Len(strText)
If intWhere3 <= intCount + 97 And intWhere3 > 0 Then
strText3 = Mid(strText, intCount + 85, intWhere3 - 85 - intCount)
strText2 = strText2 + strText3
intCount = intWhere3 - 84
ElseIf intEndLine <= intCount + 97 And intEndLine - intCount >= 85 Then
strText3 = Mid(strText, intCount + 85, intEndLine - 85 - intCount)
strText2 = strText2 + strText3
intCount = intEndLine - 84
End If
Printer.Print strText2
intCount = intCount + 85
Wend
End If
intWhere = intWhere2
intWhere2 = InStr(intWhere + 1, strWholeText, vbCr)
If intWhere2 = 0 Then
GoTo 100
End If
Wend
100:
Printer.EndDoc

Word Wrap &amp; Printing
I am using VB6 and am trying to have my application print the long string in a textbox. The textbox is set for multiline=true, but when it prints, it prints without word wrap and will only print out to the edge of the page.

The print command is simply:

printer.print Tab(5); Text1.text

How do I make it wrap the string when printing?

Thanks.

Word Wrap In Msflexgrid
Despite setting the word warp properies for msflexgrid to True and seeting the same to True again in the code, I am not able to display the full contents in the msflexgrid's small cells. what could be wrong?

MSHFlexGrid - Word Wrap
Hi guys
i am trying to set word wrap with an MSHFlexGrid, i have seen many posts on this subject and infact even releveled some code but they all seem to point to a MSFlexGrid personally other than the name i dont know what the differnce is.
what i do know is i cant get the code for MSFlexGrid to work with MSHFlexGrid.

1/ what is - are the differences one against the other.
2/ how do i set word wrap on a MSHFlexGrid? - the code i have seen all seem to hinge around passing the data into a lable with its properties to wrap first and setting the Row high based on the row height of the lable.

any good examples would be great as even googleing seems to reveal mainly MSFlexGrid results when i googled for MSHFlexGrid.

thanks

Word Wrap TextBox
Is it possible to use wrapping on text box without using multiline?

HTML Word Wrap
Alright:

Problem: Text1.text contains a paragraph of alphanumeric text and no other special characters. MultiLine is set to "on", so it word wraps in the program.

Upon Pressing a Submit button Text1.text is sent to an html file. When the HTML file is viewed the entire paragraph shows up as a single line of text that runs off the page to the right - There is no word Wrap in the destination.

What I need is a way to insert a <BR> Tag in the Text1.text paragraph for a specific number of characters. Lets say that for every 50 characters the <BR> tag is inserted. Then when Text1.text is sent to the html file and viewed it will read as a paragraph and not a single line of text.

After some research I found this code snippit:


VB Code:
linecount% = 0 ' This variable holds the total number of linescharsInFile% = Len(Text4.Text) 'Get total number of characters in boxFor i% = 1 To charsInFile% 'Move one character at a time thru boxletter$ = Mid(Text4.Text, i%, 1) 'Put next character in letter$If letter$ = Chr(50) Then 'If carriage return found (end of line!)linecount% = linecount% + 1 'Go to next line (add to count)i% = i% + 1 'Skip line feed character (which always follows cr)End IfNext i%


Now as I understand this - it reads character 50 as the end of the line and starts looking for another set of 50. How can I get it to insert a <BR> tag for every 50th character.

Will this code help me or am I barking up the wrong tree?

How can I get the code to insert "<BR>"

Printer &amp; Word Wrap
Did search the forums on this one but couldn't see a likely answer so...

How can you tell, from the Printer object, what your maximum textwidth should be before you start wrapping things?

Word Wrap In MSHFlexgrid
Is there any way to wrap the text displayed in a MSHFlexgrid cell..??

Word Wrap In A List Box
Hi all, how can you set it so that the elements you add into a list box are visible at all times - ie they wrap...

Can You Word Wrap Your Code?
Pretty annoying when i always have to scroll over the the right of the screen to see my code. Seeing as i run in 800x640 this happens a lot.

Richtextbox Word Wrap On And Off
How do I turn word wrap on? and off? ( in two seperate codes with two command buttons one for on and one for off)

Copyright 2005-08 www.BigResource.com, All rights reserved