VB中的网址转换问题

来源:百度知道 编辑:UC知道 时间:2024/05/31 12:18:13
我弄了一个判断语句,想输入"www.baidu.com"时打开“www.google.com
If Text1.Text = "www.baidu.com" Then
Text1.Text = "www.google.com"
End If
但是输入进TEXT1后依然打开的是baidu
求高人给代码

以下皆可:
If InStr(Text1.Text, "baidu.com") > 0 Then
Text1.Text = Replace(Text1.Text, "baidu.com", "google.cn")
End If

If Text1.Text = "www.baidu.com" Then
Text1.Text = "www.google.cn"
End If

此代码放在哪了,是text1_change()吗?

Text1.Text = "www.google.com" 这句改为
text1.text="www.google.cn"