Results 1 to 5 of 5

Thread: a very easy hard question ! (seltext)

  1. #1

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Code:
    text1.fontbold
    text1.fontitalic
    text1.fontunderline
    No problems, the above I can do to make all the text in a box bold, italic, underline etc.

    If I wanted just the selected highlighted text to be bold if I click a commandbutton, I think I have to use the seltext option, so I have been trying :

    Code:
    text1.seltext.fontbold
    which does not work, all I have left to put here then is HHHHEEEEELLLLPPPPPP!!!!!! (please, alright then, pretty please).

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  2. #2
    Lively Member
    Join Date
    May 2000
    Location
    Norway
    Posts
    112
    Probably because I dont think a textbox can be used that way. You can have one setting for one textbox. That is one font, one color, etc...

    RichText-control on the other hand has what you need.

  3. #3
    Guest
    As Thomas Halsvik said, use a RichTextBox. Here is a code can use for it as well:

    Code:
    Private Sub Command1_Click()
    If RichTextBox1.SelText <> "" Then
    RichTextBox1.SelBold = Not RichTextBox1.SelBold
    End If
    End Sub
    This will highlight whatever item is selected. If it's highlighted again while it's bold, when you click the command button, it will make the text not bold anymore.

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    As stated it won't work on seltext but on a text box
    it is not as you stated, you must give it a value.

    Correct Way.

    Text1.FontBold = True
    Text1.FontItalic = True
    Text1.FontUnderline = True
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Thank you, spotted that one though (I was writing from memory - which I have little sane amounts of).

    Will use the rich text box then, thankx everyone!

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

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