Export (0) Print
Expand All

My.Computer.Network.IsAvailable Property 

Indicates whether a computer is connected to a network.


' Usage
Dim value As Boolean = My.Computer.Network.IsAvailable
' Declaration
Public ReadOnly Property IsAvailable As Boolean

Boolean.

IsAvailable always returns False when called from a Click Once application or if the user does not have NetworkInformationPermission.

The following table lists examples of tasks involving the My.Computer.Network.IsAvailable property.

To See

Check whether a computer is connected to a network

How to: Check Connection Status in Visual Basic

This example checks the property's status and reports it.

If My.Computer.Network.IsAvailable = True Then
    MsgBox("Computer is connected.")
Else  
    MsgBox("Computer is not connected.")
End If

Namespace: Microsoft.VisualBasic.Devices

Class: Network

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

Availability by Project Type

Project type Available

Windows Application

Yes

Class Library

Yes

Console Application

Yes

Windows Control Library

Yes

Web Control Library

Yes

Windows Service

Yes

Web Site

Yes

The following permissions may be necessary:

Permission Description

FileIOPermission

Controls the ability to access files and folders. Associated enumeration: Unrestricted.

WebPermission

Controls rights to access HTTP Internet resources. Associated enumeration: Unrestricted.

For more information, see Code Access Security and Requesting Permissions.

Community Additions

ADD
Show:
© 2014 Microsoft