Skip to main content

VB.NET
Find & Replace Text in RichTextBox

Form1.vb

' AZUL CODING ---------------------------------------
' VB.NET - Find & Replace Text in RichTextBox
' https://youtu.be/UxJVpZbJTHw


' FIND BUTTON
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    RichTextBox1.Find(TextBox1.Text, 0, RichTextBoxFinds.None)
    RichTextBox1.Find(TextBox1.Text, 0, RichTextBoxFinds.MatchCase)

    RichTextBox1.Focus()

End Sub

' REPLACE BUTTON
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    RichTextBox1.SelectedText = TextBox2.Text

End Sub

Enjoying this tutorial?