Free Programming Tutorials & Source Code

 
  • Increase font size
  • Default font size
  • Decrease font size
Home C# Get Computer Name Using C#

Get Computer Name Using C#

E-mail
(4 votes, average: 4.25 out of 5)

Get a computer’s name by using the static method Dns.GetHostName.

Required Namespace:

using System.Net;

The code:

String ComputerName = Dns.GetHostName();
MessageBox.Show("You Computer Name is :” + ComputerName);