by Vineeth Venugopal (7 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 9th June 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)
gives the computer name you are working on
Private Sub Command1_Click()
Call Computer_Name
End Sub
Private Function Computer_Name() As String
Dim nComputer As String 'Computer Name
Dim nBuffer As String
Dim nSize As Long
nBuffer = Space$(250)
nSize = Len(nBuffer)
If GetComputerName(nBuffer, nSize) = 1 Then
nComputer = Trim(nBuffer)
MsgBox nComputer
Exit Function
End If
End Function