|
-
Jan 30th, 2002, 05:01 AM
#1
Junior Member
OK, I will use the previous code with a few mods/additions to allow for you to change the 'you' to 'me'.
Dim strPos as Integer
' The following line will search for 'you' in the textbox and return
' the position in the textbox
strPos = Instr(txtInfo.Text, "you")
' If the position returned is greater than 0 then we have
' found 'you' so now replace it with 'me'.
If strPos > 0 Then
' The Mid function returns a string from within another string
' based on the start position of 1 and the length of strPos.
' strPos being the start of the word 'you'.
' If you don't specify a length then it is considered to be the
' length of the remaining text.
txtInfo.Text = Mid(txtInfo.Text, 1, strPos - 1) & "me" & _
Mid(txtInfo.Text, strPos+3)
End If
I hope this helps.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|