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




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.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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 On A Listbox?
Hi,
I want my program to be able to download a list from the internet using the inet control and show the list in a listbox. I can get the information put into the list using additem but the whole txt file goes into the top line of the list. Is there some way I can automatically get my program to take a new line in the list for each item?

John

Printing Listbox Contents To Printer - Word Wrap
My apologies to all those fanatical members who read this, its a question from a newbie!

I have tried Martin Liss suggestions (1 to 5) but cannot get a specific answer, so I would be very grateful for some help, please.

I am trying to print the contents of a list box to the printer. Whilst I can get this to work perfectly, the contents run off the page - no matter what size I set the text.

Is there something obvious I have missed here (like word wrap) or should I use a different method to overcome the issue.

Again apologies to the Senoir developers for this very basic question.

Richard

Wrap Listbox Item
Hi,
I need to wrap the items (text) in a list box, because I am expecting that each item will be 2-3 lines. Can anyone help ?
thanks

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 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 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)

Word Wrap In Printing
hi
I have just made a word processor. the user has the option to have the text wrap onto a new line or to continue on the same line. The text is displayed correctly in the program, but when i print, there is no wrpa, even when user has wrap set to true in the program.

this is my code for the print function, i'm using the common dialogue box

VB Code:
Private Sub mnuPrint_Click()    Dim intLoop As Integer        cdlPrinter.ShowPrinter        For intLoop = 1 To cdlPrinter.Copies        Printer.Print txtPad.Text       'output is all the text in the text box        Printer.EndDoc                  'send the output to the printer    Next intLoopEnd Sub


if anyone wants to see my code for word wrap, just ask

Word Wrap Weirdness!
Okay, take the attached text file and open it up in NotePad with word wrap turned on. Notice that the "?Preoperational children can't conceive number." line is on it's own line.

With the file sitting there, turn off word wrap. See that? As soon as you turn word wrap off, "?Preoperational children can't conceive number." shares a line with the previous.

The weirdest thing: it only shows up this way when you load it with word wrap on and then shut it off. Try loading it with word wrap already turned off and you'll see it remaining on it's own separate line. You have to turn it on and then off again to see "?Preoperational children can't conceive number." revert to sharing a line.

The reason I need to know why this is happening is that it totally screws up the way my program is reading the script for my quizzes. The "?" needs to be on it's own line and it looks like it's on it's own line in my bundled text box editor, but internally, when my program takes interprets the exact same file, it's reading it with the "?" joined to the previous, the same way it looks when you load it with word wrap on and then you shut it off.

WHAT'S UP WITH THAT???

Disabling Word Wrap
How do you disable word wrap in a rich text box? I'm sure it's simple but i can't figure it out. I couldnt find any word wrap property.

Word Wrap + Another Questions
Ok..here are those questions..

1) how would you make a text box with vertical and horizontal scroll bars use word wrap?

2) How would you make the title of each text box Untitled and then for every new MDIwindow (like MSWord) whenever someone makes a new window it will start with Untitled to Untitled1 then Untitled2..does anyone understand that?

3) how would you make the caption of that title bar the document file name?

4) and how would you change the font in the text box? like bring up the font box and stuff? yeah.


does anyone understand this? i need help badly....

Word Wrap In Textbox?
This is probably easy but I'm not sure how to do it yet....How can u make a text box that has word wrap on in it?

Cujo

Word Wrap Richtext?
how can I wordwrap a richtext box so that horizontal scroll bars are not needed?

Word Wrap TextBox?
I want to allow the user to key in text into a textbox, if the text is too long, then it will wrap to another line and then a scroll bar displayed (it seems Delphi is like that). But I am not going to use Ctrl-Enter, since that will embed a CHR(10) in the data which I cannot save to DB.

So, is this possible...how?


Thanks

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?

Text Box Word Wrap??
When I create a text box thru a macro, how can I make it automatically Word Wrap??

Thanks in advance,

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