# Re: 请问 : textbox 中有没有方法 or 能不能做到 (详内)

Posted by dino on August 23, 1999 at 18:51:42:

In Reply to: 请问 : textbox 中有没有方法 or 能不能做到 (详内) posted by Albert Chiu ~~~~ on August 23, 1999 at 13:18:40:

每碰到"好"...会以方框代替

Private Sub Text1_Change()

strTarget = "好"
strReplace = "□"

If InStr(1, Text1.Text, strTarget) <> 0 Or not isnull(InStr(1, Text1.Text, strTarget)) Then
If Text1.SelStart < Len(Text1.Text) Then
i = Text1.SelStart
Text1.Text = Mid(Text1.Text, 1, CLng(Text1.SelStart - 1)) & strReplace & Mid(Text1.Text, CLng(Text1.SelStart + 1))
Text1.SelStart = i
Else
Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1) & strReplace
Text1.SelStart = Len(Text1.Text)
End If
End If

End Sub

Follow Ups: