My.Computer.Name Property

Gets the computer name.

' Usage
Dim value As String = My.Computer.Name
' Declaration
Public ReadOnly Property Name As String

Property Value

A String containing the name of the computer.

Remarks

The My.Computer.Name property provides functionality similar to the MachineName property.

Example

This example uses the My.Computer.Name property to display the name of the computer on which the code runs.

MsgBox("Computer name: " & My.Computer.Name)

Requirements

Namespace:Microsoft.VisualBasic.Devices

Class:Computer, ServerComputer

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

Permissions

No permissions are required.

See Also

Reference

My.Computer Object

MachineName

ServerComputer.Name