Free Programming Tutorials & Source Code

 
  • Increase font size
  • Default font size
  • Decrease font size
Home Visual Basic.NET Get Computer Name Using VB.NET

Get Computer Name Using VB.NET

E-mail
(3 votes, average: 4.33 out of 5)
Get a computer’s name by using the static method Dns.GetHostName in VB.NET

Required namespace for this snippet:


Imports System.Net


Show the computer name in a message box:


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


Happy coding!