Click here to Skip to main content
12,244,322 members (50,652 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB6 VB VB.NET RichTextBox
I have a string as "Hello World" in the RichTextBox. I am selecting the each word and applying style.In this string "Hello" is bold and having strike-Through.Suppose I want to apply underline to the complete Text (Hello world).The previous style for which the "Hello" has is removing and new style is appending.This is a migrated project to VB.NET when we do the same in VB6 it is working perfectly.It is not working in VB.NET.

If richTb1.SelectionFont.Underline Then
            richTb1.SelectionFont = VB6.FontChangeUnderline(richTb1.SelectionFont, False)
Else
            richTb1.SelectionFont = VB6.FontChangeUnderline(richTb1.SelectionFont, True)
End If
Posted 20-Feb-13 3:40am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

At last I had fixed the issue by restyling the text char by char .See my solution

If rtfBox.SelectionFont.Bold Then
            For x As Integer = selectionStart To selectionEnd - 1
                rtfBox.Select(x, 1)
                rtfBox.SelectionFont = VB6.FontChangeBold(rtfBox.SelectionFont, False)
            Next
Else
            For x As Integer = selectionStart To selectionEnd - 1
                rtfBox.Select(x, 1)
                rtfBox.SelectionFont = VB6.FontChangeBold(rtfBox.SelectionFont, True)
            Next
End If
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 11 Mar 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100