Click here to Skip to main content
15,911,848 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have Richtextbox1 and it was multiple font content which is involved with ms access database... but when i click Datagridview1 it was successfully opened in Richtextbox1 but only one language or one font content showed but another font not showing properly

please help me

What I have tried:

Public Class SongShow

    Private Sub RichTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles RichTextBox1.KeyPress

    End Sub

    Private Sub SongShow_Load(sender As Object, e As EventArgs) Handles MyBase.Load, RichTextBox1.VisibleChanged
        'TODO: This line of code loads data into the 'SongDataSet.MAS_SONGS' table. You can move, or remove it, as needed.
        Me.MAS_SONGSTableAdapter.Fill(Me.SongDataSet.MAS_SONGS)

    End Sub


    Private Sub SongShow_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.Escape Then
            Me.Close()

        End If
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim colors As DialogResult
        colors = ColorDialog1.ShowDialog

        If colors = Windows.Forms.DialogResult.OK Then
            RichTextBox1.ForeColor = ColorDialog1.Color

        End If
    End Sub

    Private Sub RichTextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles RichTextBox1.KeyDown
        If e.KeyCode = Keys.Tab Then
            RichTextBox2.Show()
            RichTextBox1.Visible = False
            RichTextBox2.Visible = True
        End If
    End Sub

    Private Sub RichTextBox2_KeyDown(sender As Object, e As KeyEventArgs) Handles RichTextBox2.KeyDown
        If e.KeyCode = Keys.Tab Then
            RichTextBox1.Show()
            RichTextBox2.Visible = False
            RichTextBox1.Visible = True
        End If
    End Sub

    Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged

    End Sub
End Class
Posted
Updated 20-Oct-19 8:33am

1 solution

See answer here: How to set multiple Font.Styles to a Rich Text Box[^]

To select part of the text use SelectionStart and SelectionLength, then set the style like this:
RichTextBox1.SelectionFont = New Font("Tahoma", 20)

Also see this example: Two fonts underline in richtextbox - VB.NET[^]
 
Share this answer
 
v2
Comments
Member 14621280 20-Oct-19 14:50pm    
I am new to this can please send source code to me please

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900