Dear all,

Can anyone kindly let me know how to put codes in my program to check if the network card is currently connects to nowhere (in nortification area, the small computer icon is crossed in red). Many thanks!

Best regards,
Gibbs

Recommended Answers

All 5 Replies

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim bNetworkCablePlugged As Boolean = True
        Try
        Catch ex As Exception
            If Err.Number = 5 Then
                bNetworkCablePlugged = False
            End If
        End Try
    End Sub

If the control goes inside the catch block,then the network cable is unplugged..Note that the error number is 5 only...for netwrok...

I hope this helps...

hey frnd tell me mine soln is not working for u?

or you can go to Project - WindowsApplication1 Properties - choose the Application Tab and click on "View Application events"

Then the ApplicationEvent.vb opens....

There you can add your code

Private Sub MyApplication_NetworkAvailabilityChanged(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.Devices.NetworkAvailableEventArgs) Handles Me.NetworkAvailabilityChanged
            If e.IsNetworkAvailable Then
                MsgBox("Yippiiee we r online")
            End If
        End Sub

hey frnd tell me mine soln is not working for u?

Thanks Sonia, I think this is what I want. However, is it possible to monitor only a specific network card in case I have 3 NICs in my computer? Thanks again.

Best regards,
Gibbs

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.