利用 VB.net 取得本機 IP
Imports System.Net.Dns
 


Public Function GetIPaddress() As String
Try
Dim ipEntry As System.Net.IPHostEntry = GetHostByName(Environment.MachineName)
Dim IpAddr As System.Net.IPAddress() = ipEntry.AddressList
 


GetIPaddress = IpAddr(0).ToString
Catch ex As Exception
GetIPaddress = "無法取得IP"
End Try
End Function

創作者介紹
創作者 個人記事 的頭像
dark99

個人記事

dark99 發表在 痞客邦 留言(0) 人氣( 3491 )