Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

  • Leaders
Posted

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...