Results 1 to 3 of 3

Thread: Wordwrap in textboxes

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Location
    London, UK
    Posts
    145
    I'm working on a simple editor application a la Notepad, and I want the user to be able to choose to break the lines of the text after the windowsize.
    I know you can use Wordwrap in Labels, but is there a similar command for textboxes?
    I also wonder how I can make a post on a menu where you can choose an alternative, like wordwrap, on or off (with a little mark before the text to show it's enabled or disabled.

    Hope someone can help me,
    greetings,

    Pentax
    Wilhelm Tunemyr,
    Swede in London

    [email protected]

    "Dort, wo man Bücher verbrennt, verbrennt man am Ende auch Menschen"
    Heinrich Heine (1797-1856)

    Pravda vítezi!
    (Truth prevails!)

  2. #2
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Cleveland, Ohio
    Posts
    263
    Well... for a text box it should have its multiline property to true, and then the scrollbars property should be set to vertical or both... but if you want to make it wrap at a certain size, then you'll have to put some code into the form's resize event in regaurds to the width of the text box relative to the length of the chars of a particular line in text (Get this with the TextWidth). However, finding all the lines that match a certain length or longer will take a while with a large amount of text, so... good luck! You can use a menu to activate and deactivate this feature, you can use its check property.

  3. #3
    Addicted Member jcouture100's Avatar
    Join Date
    Aug 1999
    Posts
    141
    I would recommend using the RichTextBox control instead of the TextBox control. It also has the multi-line property and word-wraps text by default. It also has the Right Margin Property which will allow you to set specifically where you want the word-wrap to occur. It also provides many other methods (such as Find Text) that make it more useful for text editing.

    For the menu part, create your menu in the VB Menu Editor. There is a property called Checked that you can set at run-time. For example: if you had a menu item called mnuOptionWordWrap you could set it to be checked using the following:

    mnuOptionWordWrap.checked = True

    You'll have to forgive me if the syntax or property name isn't exactly correct, but it should be close.

    Hope this helps.

    JC.
    JC

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width