mercicle Posted June 13, 2003 Posted June 13, 2003 hi guys, I am half way through with my app and i am really stuck... i want to manipulate (delete certain text) in a .txt, that i load into a richtextbox in my app. it is a simple program.... (three buttons open/delete/save, and a richtextbox 1.) i load a .txt content into a rtb 2.) i want to scan the entire contents of the rtb, and delete every instant of, for example: "me@you.com" 3.) i want to save the completed work back as a .txt I am having problems with the event proedure for the deletion of the text i want deleted. should i automate word, and scan like a spellcheck? i tried using the split() fuction first, had no luck, because i can't figure out how to apply it to the rtb text... i tried all day, and i am really frustrated, some one please put me out of my misery. Quote
Leaders dynamic_sysop Posted June 13, 2003 Leaders Posted June 13, 2003 you could try this : Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click With rtfBox .Find(TextBox1.Text) .SelectedText = "" End With End Sub or this would get rid of them all in 1 go : Dim str() As String, s As String, i As Integer s = rtfBox.Text str = Split(s, Chr(32)) For i = 0 To UBound(str) If str(i) = TextBox1.Text Then rtfBox.Text = Replace(rtfBox.Text, str(i), " ") End If Next Quote
Recommended Posts