|
-
Dec 10th, 2002, 07:51 AM
#1
Thread Starter
Hyperactive Member
Bold on, bold off *[RESOLVED (#2)]*
To turn bold on and off in a richtextbox in VB6, you did this:
VB Code:
rtbSectionText.SelBold = Not rtbSectionText.SelBold
What's the equivalent in .NET?
Thanks.
Last edited by RealNickyDude; Dec 11th, 2002 at 11:55 AM.
-
Dec 10th, 2002, 12:15 PM
#2
Try this:
VB Code:
If RichTextBox1.SelectionFont.Bold Then
RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, FontStyle.Regular)
Else
RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, FontStyle.Bold)
End If
-
Dec 10th, 2002, 01:09 PM
#3
Thread Starter
Hyperactive Member
-
Dec 10th, 2002, 01:37 PM
#4
Thread Starter
Hyperactive Member
-
Dec 10th, 2002, 02:47 PM
#5
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:
If RichTextBox1.SelectionFont.Bold Then
RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, RichTextBox1.SelectionFont.Style - FontStyle.Bold)
Else
RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, RichTextBox1.SelectionFont.Style + FontStyle.Bold)
End If
-
Dec 11th, 2002, 11:55 AM
#6
Thread Starter
Hyperactive Member
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!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|