Results 1 to 6 of 6

Thread: Bold on, bold off *[RESOLVED (#2)]*

  1. #1

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435

    Thumbs up Bold on, bold off *[RESOLVED (#2)]*

    To turn bold on and off in a richtextbox in VB6, you did this:

    VB Code:
    1. rtbSectionText.SelBold = Not rtbSectionText.SelBold
    What's the equivalent in .NET?

    Thanks.
    Last edited by RealNickyDude; Dec 11th, 2002 at 11:55 AM.
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Try this:
    VB Code:
    1. If RichTextBox1.SelectionFont.Bold Then
    2.             RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, FontStyle.Regular)
    3.         Else
    4.             RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, FontStyle.Bold)
    5.         End If

  3. #3

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    Yup

    Just another thing i've noticed that takes a lot more effort than VB6

    Thanks Edneeis
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  4. #4

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    Nope Not quite

    I need to turn on / off a single text attribute only; so if text is bold and italic, then add underline, the text should have all 3, then if the user turns off italic, the text will be left bold and underline.

    More help?

    And why is it so hard in NET, that was so easy in VB6
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    It does seem like its more trouble than it should be, but I wouldn't say its so hard. Most things in .NEt are easier I would say, but not this one.

    VB Code:
    1. If RichTextBox1.SelectionFont.Bold Then
    2.             RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, RichTextBox1.SelectionFont.Style - FontStyle.Bold)
    3.         Else
    4.             RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, RichTextBox1.SelectionFont.Style + FontStyle.Bold)
    5.         End If

  6. #6

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435

    Thumbs up

    It does seem like its more trouble than it should be, but I wouldn't say its so hard. Most things in .NEt are easier I would say, but not this one.
    I agree, the advantages far outweight the disadvantages, it's just some things that were simple in VB6 (like Buttongroups, Setting / unsetting text attributes and making a lable transparent) seem to be more complicated to do.

    Can you tell i'm a beginner

    ...and thanks for the code, now it works a treat!
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

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