T
Tony WONG
i write the following program to detect workstation ON or OFF
but i do not know how to paste the parameter from Timer1_Tick to pingwork
it comes to error in these lines -- WorkName
Private Sub pingwork(ByVal WorkIP, ByVal WorkName)
Dim WorkName As New Button
Could you teach me to do it? Thanks a lot.
************************************************
Public Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
pingwork("Work01", "Work01")
pingwork("Work02", "Work02")
End Sub
Private Sub pingwork(ByVal WorkIP, ByVal WorkName)
Dim WorkName As New Button
Controls.Add(WorkName)
WorkName.Text = WorkIP
If My.Computer.Network.Ping(WorkIP) Then
WorkName.BackColor = Color.Gold
WorkName.ForeColor = Color.Black
Else
WorkName.BackColor = Color.Black
WorkName.ForeColor = Color.White
End If
WorkName.Refresh()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Timer1.Interval = 5000
Timer1.Enabled = True
End Sub
End Class
but i do not know how to paste the parameter from Timer1_Tick to pingwork
it comes to error in these lines -- WorkName
Private Sub pingwork(ByVal WorkIP, ByVal WorkName)
Dim WorkName As New Button
Could you teach me to do it? Thanks a lot.
************************************************
Public Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
pingwork("Work01", "Work01")
pingwork("Work02", "Work02")
End Sub
Private Sub pingwork(ByVal WorkIP, ByVal WorkName)
Dim WorkName As New Button
Controls.Add(WorkName)
WorkName.Text = WorkIP
If My.Computer.Network.Ping(WorkIP) Then
WorkName.BackColor = Color.Gold
WorkName.ForeColor = Color.Black
Else
WorkName.BackColor = Color.Black
WorkName.ForeColor = Color.White
End If
WorkName.Refresh()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Timer1.Interval = 5000
Timer1.Enabled = True
End Sub
End Class