请教高手,实在找不出哪里错了。
提示:实时错误“424”要求对象
----------------------------
Private Sub Command1_Click()
Dim d() As String, t As String
Dim l As Long
Open "c:\WINDOWS\system32\drivers\etc\hosts" For Input As #1
While Not EOF(1)
Line Input #1, t
t = Trim(t)
If Left(t, 1) <> "#" And Len(t) > 0 Then
ReDim Preserve d(0 To l) As String
d(l) = UCase(t)
l = l + 1
End If
Wend
Close #1
For l = 0 To UBound(d)
If InStr(d(l), UCase(Text2.Text)) > 0 Then '这里只检查网址,也可以改成text1.text就是检查IP的
MsgBox "定义有重复" & d(l)
Exit Sub
End If
Next l
Open "c:\WINDOWS\system32\drivers\etc\hosts" For Append As #1
Print #1, Text1.Text & " " & Text2.Text
Close #1
End Sub
Private Sub Form_Load()
Text1.Text = "127.0.0.1"
Text2.Text = "www.baidu.com"
End Sub
===============
帮帮忙啊,谢谢。
在窗体上放两个文本框 出错的时候具体是哪行代码? Text1.Text = "127.0.0.1"
Text2.Text = "www.baidu.com"
就像2楼说的一样。text1,text2这2个文本框你有没
补充:VB , API