Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

local machine name

Status
Not open for further replies.

trezlub

Programmer
May 2, 2003
67
GB
How do you get the local machine name into VB?

I need to display the value somehow. Any ideas?
 
Have you tried using the GetComputerName API?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
/me has bad flash backs
"CajunCenturion I don't want to use API's"

Don't ask me why I'm having flash backs...I just find it funny and had to say it.
No reflection on you trezlub.

I think its just senility setting in hard.
 
I based this on something I found by searching MSDN

Also should appeal to those whose prefer script objects over API's

Dim WshNetwork As Object

Set WshNetwork = CreateObject("WScript.Network")
Debug.Print "Domain = " & WshNetwork.UserDomain
Debug.Print "Computer Name = " & WshNetwork.ComputerName
Debug.Print "User Name = " & WshNetwork.UserName
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top