Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6390865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:36:02+00:00 2026-05-25T03:36:02+00:00

I’ve got to do some special things with a RichTextBox. I have to add

  • 0

I’ve got to do some special things with a RichTextBox. I have to add syntax highlighting and I need to be able to find out what character was added/removed/inserted at what position every time a key is pressed. Is there some way to edit the existing, or is there a open source (.net compatible, preferably VB.net) available for download? I’ve tried making my own, the problem is, it has to have every function normally available and I don’t have enough time to implement all of that.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:36:03+00:00Added an answer on May 25, 2026 at 3:36 am

    There’s no need to reinvent the wheel here. You have two options for doing this. The first is that you can hook into the events raised by your RichTextBox and do what you need there:

    Private Sub RichTextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
        'Add code to figure out what changed
        'This will most likely involve an variable storing the original text and comparing it to what the
        'RichTextBox now contains
    End Sub
    

    There are a few issues with this. If you have to use the functionality in a lot of forms, you start duplicating code everywhere. You’ll also need some helper variables to track this data.

    A better solution would be to create your own RichTextBox class. Obviously you don’t want to have to start again from scratch, so you can instead inherit from the existing class and then extend it how you want.

    Public Class MyRichTextBox
        Inherits System.Windows.Forms.RichTextBox
    
        Private oldText As String
    
        Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
            MyBase.OnTextChanged(e)
    
            If Me.Text <> oldText Then
                'Figure out what changes were made
            End If
    
            oldText = Me.Text
        End Sub
    
        Public Sub SyntaxHighlighting()
            'Add code here to highlight syntax within the textbox
        End Sub
    End Class
    

    Once you’ve compiled MyRichTextBox, it should show up on the Toolbox tab and then you can drag & drop it onto your form.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
I have this code to decode numeric html entities to the UTF8 equivalent character.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.