by Yuening Dai (30 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 9th January 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Searche for Specified String and Replace it with What You Want, Using Function Replace in VB6
'"txtTest" will be replaced by "%". Notice: only first 3 found chars will
'be replaced. For example, abababab -> %b%b%bab. If you want replace all
'char of "a", use Replace(sTest, sFirstChar, "%", 1).
Private Sub cmdReplace_Click()
'
Dim sTest As String
Dim sFirstChar As String
'
'
sTest = txtTest.Text
sFirstChar = Mid(sTest, 1, 1)
txtTest.Text = Replace(sTest, sFirstChar, "%", 1, 3)
'
End Sub
No comments have been posted about Searche for Specified String and Replace it with What You Want, Using Function Replace in VB6. Why not be the first to post a comment about Searche for Specified String and Replace it with What You Want, Using Function Replace in VB6.