Option   Explicit 
Dim   X1   As   Long,   Y1   As   Long '开始Ping 
Private   Sub   Command1_Click() 
'如果值都是合理的,开始ping 
If   ValuesFaild   =   True   Then 
        Command2_Click 
        Command1.Enabled   =   False 
        Command3.Enabled   =   True 
        Text1.Enabled   =   False 
        Text2.Enabled   =   False 
        Text3.Enabled   =   False 
        Graphic.ScaleHeight   =   Val(Text3) 
        '设置IP 
        SetIp   Text1 
        Label1(0).Caption   =   Text3 
        Timer1.Interval   =   Text2 
        Timer1.Enabled   =   True 
End   If 
End   Sub '清除结果 
Private   Sub   Command2_Click() 
Label4(0).Caption   =   0 
Label4(1).Caption   =   Text3 
List1.Clear 
Graphic.Cls 
Graphic.Width   =   GrapHolder.ScaleWidth 
Scroll.Value   =   0 
Scroll.Max   =   0 
X1   =   0 
Y1   =   Graphic.ScaleHeight 
End   Sub '停止ping 
Private   Sub   Command3_Click() 
Command1.Enabled   =   True 
Command3.Enabled   =   False 
Text1.Enabled   =   True 
Text2.Enabled   =   True 
Text3.Enabled   =   True 
Timer1.Enabled   =   False 
End   Sub '初始化时清除结果 
Private   Sub   Form_Load() 
Command2_Click 
End   Sub 'Graphic要支持滚动 
Private   Sub   Scroll_Change() 
Graphic.Left   =   -Scroll.Value 
End   Sub 'Ping返回时间 
'写入Log 
Private   Sub   Timer1_Timer() 
Dim   Ret   As   PingReturn 
Dim   X2   As   Long,   Y2   As   Long 
Ret   =   Pinger(20,   Val(Text3)) 
List1.AddItem   Ret.Discriptionn 
List1.ListIndex   =   List1.ListCount   -   1 
X2   =   X1   +   2 
Y2   =   Graphic.ScaleHeight   -   Ret.Ping 
If   Ret.Errors   =   True   And   Check1.Value   =   1   Then   Exit   Sub 
If   Label4(0).Caption   <   Ret.Ping   Then   Label4(0).Caption   =   Ret.Ping 
If   Label4(1).Caption   >   Ret.Ping   Then   Label4(1).Caption   =   Ret.Ping 
Graphic.Line   (X1,   Y1)-(X2,   Y2),   vbRed 
X1   =   X2 
Y1   =   Y2 
CalcFieldandScroll   X1   +   4 
End   Sub '看值是否有效(这里只看一下是否为空) 
Function   ValuesFaild()   As   Boolean 
If   Len(Text1)   =   0   Then   MsgBox   "Can't   start   with   out   an   ip   adress!",   vbInformation   +   vbOKOnly,   "Error":   Text1.SetFocus:   Exit   Function 
If   Len(Text2)   =   0   Then   MsgBox   "Can't   start   with   out   an   interval   (Defuald   :   1000)",   vbInformation   +   vbOKOnly,   "Error":   Text2.SetFocus:   Exit   Function 
If   IsNumeric(Text2)   =   False   Then   MsgBox   "Can't   start   with   out   an   falid   interval   (Defuald   :   1000)",   vbInformation   +   vbOKOnly,   "Error":   Text2.SetFocus:   Exit   Function 
If   Len(Text3)   =   0   Then   MsgBox   "Can't   start   with   out   an   max   ping   value   (Defuald   :   1000)",   vbInformation   +   vbOKOnly,   "Error":   Text2.SetFocus:   Exit   Function 
If   IsNumeric(Text3)   =   False   Then   MsgBox   "Can't   start   with   out   an   falid   max   ping   value   (Defuald   :   1000)",   vbInformation   +   vbOKOnly,   "Error":   Text2.SetFocus:   Exit   Function 
ValuesFaild   =   True 
End   Function '计算 
Function   CalcFieldandScroll(WidthNeed   As   Long) 
Dim   Ret   As   Boolean 
If   Scroll.Value   +   20   >   Scroll.Max   Then   Ret   =   True 
If   WidthNeed   >   Graphic.ScaleWidth   Then 
        Graphic.Width   =   WidthNeed 
        Scroll.Max   =   Graphic.Width   -   GrapHolder.ScaleWidth 
        DoEvents 
        Scroll.Refresh 
        If   Ret   =   True   Then   Scroll.Value   =   Scroll.Max 
End   If 
End   Function 
这个是我网上找的代码   在运行的时候出了点问题 
        SetIp   Text1 这个有问题 但是我改成 
        Set   Ip=   Text1.text 也不行 是怎么错了 还是没有引用什么东西哦??