Subtracting a string from 2 Textboxes

mmarkym

Member
Joined
Aug 20, 2005
Messages
13
Programming Experience
3-5
If I enter a letter in one textbox and if the letter is in the other textbox (Already contains a string), I want the letter to be removed from that textbox. I have the code below that works once but as you enter more letters it doesn't.

PrivateSub txtEnterWord_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtEnterWord.TextChanged

Dim WordToCheck AsString = txtEnterWord.Text
Dim StringToCheck AsString = txtAlphabet.Text

If StringToCheck.IndexOf(WordToCheck) Then
StringToCheck = StringToCheck.Replace(WordToCheck, "")
txtAlphabet.Text = StringToCheck
EndIf

EndSub
 
write "a" in txtEnterWord
wordtocheck="a"
stringtocheck="alpha" (example)
if indexof then
stringtocheck="lpha"
end if

next letter:

write "l" in txtEnterWord
wordtocheck="al"
stringtocheck="lpha"
if indexof then

NOT
 
Back
Top