【发布时间】:2012-11-03 12:00:44
【问题描述】:
我想获取当前的计算机名。
这是我的代码:
Public Function GetComputerName() As String
Dim ComputerName As String
ComputerName = System.Net.Dns.GetHostName
Return ComputerName
End Function
此代码有效,但我记得有更快的方法。
获取计算机名称的快速方法是什么?
【问题讨论】:
-
只需使用这行代码
System.Net.Dns.GetHostName并删除函数或此System.Windows.Forms.SystemInformation.ComputerName