.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Code Snippets >> Windows Form Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Word Filter in a RichTextBox in a Simple Way

Posted By:Hefin Dsouza       Posted Date: August 12, 2009    Points: 10    Category: Windows Form Controls    URL: http://www.dotnetspark.com  

This Code Filters the content typed in the Richtextbox and changes it to ***** if a bad word is found

Sub FilterWords()
Dim filchar As String
For Each word As String In ListBox1.Items
If RichTextBox1.Find(word) <> -1 Then
For i As Integer = 0 To RichTextBox1.SelectedText.Length - 1
filchar &= "*"
RichTextBox1.SelectedText = filchar
End If
End Sub

In this Application I am Storing Words to filter in the List box
On the richtextbox textchange event add this code

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

'Simple Codes Do More'

Regards Hefin Dsouza


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend