suatu hari kita pasti ingin tuh mendapatkan apa sih nama komputer kita yang digunakan saat ini. setelah cari sana-sini, akhirnya menemukan caranya. di bawah ini fungsi yang kubuat untuk mendapatkan nama komputer yang bisa langsung ditampilkan di aplikasi yang kita buat menggunakan VB.Net.
-----------------
One day we'll want to get what's the name of our computers are in use today. after looking here and there, finally found a way. under this function I made to get the computer name that can be instantly displayed in the applications we make use VB.Net.
-----------------
Function GetClientPCName(ByVal strUserHostAddress As String) As String
-----------------
One day we'll want to get what's the name of our computers are in use today. after looking here and there, finally found a way. under this function I made to get the computer name that can be instantly displayed in the applications we make use VB.Net.
-----------------
Function GetClientPCName(ByVal strUserHostAddress As String) As String
Dim arrComputerName As Array
Dim strComputerName As String
Dim host As String = ""
Try
arrComputerName = Split _
(Dns.GetHostByAddress(strUserHostAddress).HostName, ".")
(Dns.GetHostByAddress(strUserHostAddress).HostName, ".")
strComputerName = CStr(arrComputerName.GetValue(0))
host = strComputerName
Return host
Catch ex As Exception
host = ex.Message
End Try
End Function
Comments
Post a Comment