Right i have a form with two button a text box and a few labels. Button one when clicked pings a computer and displays the resault in the text box. Button two when clicked send a telnet command and reboots my server.
These are working fine. But i have now added a count down timer to the form (5mins). What i want to happen is when the timer gets down to 0 i want it to run the ping. So will i need to type out the ping command again in the timer_tick section or can i place this:-
Code:
Private Sub btnPing_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPing.Click
If My.Computer.Network.Ping("10.50.50.217") Then
lblDisplay.Text = "Server pinged successfully."
Count = 0
lblcount.Text = Count
Else
lblDisplay.Text = "Ping request timed out."
Count = Count + 1
lblcount.Text = Count
End If
End Sub
into a command/procedure and then call it from the button click and when the timer gets to zero.
e.g.
Code:
Private Sub btnPing_Click
call [ping_command]
end sub
and
Private Sub Timer_tick
If Counter = 0 then call [ping_command]
end sub
Or what ever the command(s) would be?