Link to home
Start Free TrialLog in
Avatar of directred
directred

asked on

Display System Information

I am writing a small app so it will display certain information about my PC. What is the syntax. The sort of system information  would be like computername, ip address, physical memory, name of hard drive etc. I know there is a syntax out there but I have forgotten as never used it before
ASKER CERTIFIED SOLUTION
Avatar of Dimandja
Dimandja
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
'VB.NET Code
Dim result As String

'Retrieve the NetBIOS name.
result = System.Environment.MachineName

'Display the results to the console window.
Console.WriteLine("NetBIOS Name = {0}", result)

'Retrieve the DNS name.
result = System.Net.Dns.GetHostByName("LocalHost").HostName

'Display the results to the console window.
Console.WriteLine("DNS Name = {0}", result)


'Visual Basic - Display computer Name

Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Private Sub Command1_Click()
Dim strBuffer As String
  Dim lngBufSize As Long
  Dim lngStatus As Long
 
  lngBufSize = 255
  strBuffer = String$(lngBufSize, " ")
  lngStatus = GetComputerName(strBuffer, lngBufSize)
  If lngStatus <> 0 Then
     MsgBox ("Computer name is: " & Left(strBuffer, lngBufSize))
  End If
End Sub