Coding for Find and Replace Function.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SLDenman
    New Member
    • Sep 2010
    • 4

    #1

    Coding for Find and Replace Function.

    I am working on a project and have come to a hault. I am not sure how to code the stings for the Find and Replace function of a notepad that I have created. How do I code to have the input on a subform be found and replaced on the mainform. I know how to code to have it find one word but how do I code it find whatever the user is looking for?
    I have attached a screen shot to show what the IDE looks like.

    Here is the main form code:

    Code:
    Public Class Editor
    
        Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click
            RichTextBox1.Clear()
        End Sub
    
        Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
            Me.Close()
    
        End Sub
    
        Private Sub ColorGroupBox_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorGroupBox.Enter
            BlackRadioButton.Checked = True
        End Sub
    
        Private Sub FontGroupBox_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontGroupBox.Enter
            CourierNewRadioButton.Checked = True
        End Sub
    
        Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
            'Terminate the project.
            Me.Close()
    
        End Sub
    
        Private Sub ClearToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearToolStripMenuItem.Click
            'Clear the textbox.
            RichTextBox1.Text = ""
        End Sub
    
        Private Sub FindandReplaceButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FindandReplaceButton.Click
            FindandReplaceForm.ShowDialog()
    
        End Sub
    
        Private Sub FindAndReplaceToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FindAndReplaceToolStripMenuItem.Click
            FindandReplaceForm.ShowDialog()
    
        End Sub
    End Class
    Here is the sub form code:


    Code:
      Public Class FindandReplaceForm
    
        Private Sub ReplaceButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReplaceButton.Click
    
        End Sub
    End Class
    Any help is appreciated.
    -Stephanie
    Attached Files
Working...