VB6.0 查找文本 替换文本 问题

2025-03-01 12:31:45
推荐回答(2个)
回答1:

Private Sub Command1_Click()
Dim s1, s2 As String
Dim i, n As Integer
n = Len(Text2.Text)
If n <= Len(Text1.Text) Then
For i = 1 To n
If Mid(Text1.Text, i, n) = Text2.Text Then
s1 = Left(Text1.Text, i - 1) & Text3.Text & Right(Text1.Text, Len(Text1.Text) - i - 1)
Text1.Text = s1
End If
Next i
End If
End Sub

回答2:

cmd1里写
text1=replace(text1,text2,text3)