What am I doing wrong? [Resolved]
Just a simple find and replace... and I just can't get it to work! Ugh I know I'm doing something wrong....
VB Code:
Private Sub mnuChildFIndandReplace_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuChildFIndandReplace.Click
'Show The Find And Replace Dialog
Dim frmReplace As New frmReplace
Me.AddOwnedForm(frmReplace)
frmReplace.ShowDialog()
CurrentToBe = frmReplace.txtReplaceThis.Text
CurrentReplace = frmReplace.txtReplaceWith.Text
Dim CharacterNumber As Integer = frmReplace.txtReplaceThis.Text.Length()
If frmReplace.chkCase.Checked = False Then
ReplaceWordLocation = txtBoxChild.Find(CurrentToBe, RichTextBoxFinds.None)
txtBoxChild.Text.Remove(ReplaceWordLocation, CharacterNumber)
txtBoxChild.Text.Insert(ReplaceWordLocation, CurrentReplace)
ElseIf frmReplace.chkCase.Checked = True Then
ReplaceWordLocation = txtBoxChild.Find(CurrentToBe, RichTextBoxFinds.MatchCase)
txtBoxChild.Text.Remove(ReplaceWordLocation, CharacterNumber)
txtBoxChild.Text.Insert(ReplaceWordLocation, CurrentReplace)
End If
End Sub