I'm attempting to do something that I know should be simple but I keep messing it up somehow. First, I'm attempting to change the font color using the color in the font dialog box, but the color will only work with the next character entered into the rich text box. Second, I'm trying to use a button to switch the font and background colors. Any suggestions?

6 Years
Discussion Span
Last Post by bhagawatshinde

Try this

Private Sub btnfont_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfont.Click
        Dim sh_colour As New FontDialog
        sh_colour.ShowColor = True

        sh_colour.Font = rtxtorg_name.Font
        sh_colour.Color = rtxtorg_name.ForeColor
        'If Not rtxtphone.SelectionFont Is Nothing Then
        '    sh_colour.Font = rtxtphone.SelectionFont
        '    sh_colour.Font = Nothing
        'End If

        If sh_colour.ShowDialog() = Windows.Forms.DialogResult.OK Then
            rtxtorg_name.Font = sh_colour.Font
            rtxtorg_name.ForeColor = sh_colour.Color
        End If

    End Sub

Hope this will help you

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.