Hello,
I am using a button to check which PCs are online which works fine so far. The problem is that the app is blocked for this time I click on the button and perform this action.
How can I do this in the background?
Thx
I am using a button to check which PCs are online which works fine so far. The problem is that the app is blocked for this time I click on the button and perform this action.
How can I do this in the background?
Thx
VB.NET:
Private Sub Button_CheckOnline_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_CheckOnline.Click
On Error Resume Next
If My.Computer.Network.IsAvailable = True Then
'Dim rowindex As DataGridViewRow
For Each row As DataGridViewRow In HardwareDataGridView.Rows
'MessageBox.Show(CStr(row.Cells(DataGridViewTextBoxColumn32.Index).Value))
If CStr(row.Cells(DataGridViewTextBoxColumn14.Index).Value) > -1 Then
If My.Computer.Network.Ping(CStr(row.Cells(DataGridViewTextBoxColumn14.Index).Value), 1000) = True Then
'MsgBox("Online")
row.Cells(StatusOnline.Index).Style.ForeColor = Color.Green
row.Cells(StatusOnline.Index).Value = "Online"
Else
'MsgBox("Offline")
row.Cells(StatusOnline.Index).Style.ForeColor = Color.Red
row.Cells(StatusOnline.Index).Value = "Offline"
End If
End If
Next
End If
End Sub