p; For temp_i = 0 To 4
Text1(temp_i).Enabled = False
Next
`进行一系列的错误判断
If Int(Text1(3)) < 0 Then GoTo error1
If Int(Text1(4)) < 0 Then GoTo error1
If Int(Text1(4)) - Int(Text1(3)) < 0 Then GoTo error1
ProgressBar1.Max = (Int(Text1(4)) - Int(Text1(3)) + 1) * 10 `定义 ProgressBar 控件的最大值,在后面的程序中可以实现"进度条"
For temp_i = Int(Text1(3)) To Int(Text1(4)) `循环开始连接各个 IP 地址
StatusBar1.SimpleText = "正在连接" & Text1(2).Text & "." & temp_i & ".."
IsFind = SearchComputer(Text1(2).Text & "." & temp_i) `通过自定函数 SearchComputer 判断该 IP 地址,是否有可以控制的计算机
temp_j = temp_j + 10 `定义"进度条"增加的块数
ProgressBar1.Value = temp_j `增加“进度条"的块数,以产生动态变化
StatusBar1.SimpleText = "搜索完毕,共找到" & sum_i & "台计算机可以控制"
Next
Command1.Enabled = True
List1.Enabled = True
For temp_i = 0 To 4
Text1(temp_i).Enabled = True
Next
Exit Sub
error1:
MsgBox "程序运行错误,请重新设置后,再运行本程序!!", vbCritical, "程序错误"
For temp_i = 0 To 4
Text1(temp_i).Enabled = True
Next
List1.Clear
&n