提示:实时错误“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
===============帮帮忙啊,谢谢。
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
===============帮帮忙啊,谢谢。
解决方案 »
- 如何在picturebox在画个一个矩形框,并可以移动它,类似photoshop中选择框
- 关于VScroll的LargeChange和Max的值如何配合
- SubClass与API高手请帮一个小忙,高分相送
- 女朋友问我的VB问题,可惜我答不上来,太没面子了,求救
- CSDN论坛社区,CSDN开发者日志登录器,自动输入CSDN验证码,自动记忆用户名及密码下次可直接登录
- 如何在文本框中提取一个字节(<255)的数据?
- 求助,如何阻止用户进入datagrid里的单元格。
- 请各位帮帮小弟,如何读取log文件的最后一条记录?
- 关于ACCESS数据库存储的问题?
- 一个高手很容易的问题!
- 将find方法封转为函数
- 复选框失灵了?
Text2.Text = "www.baidu.com"
就像2楼说的一样。text1,text2这2个文本框你有没