Imports System
Imports System.Net.Dns
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim shostname As String
shostname = System.Net.Dns.GetHostName
Console.WriteLine("Your Machine Name = " & shostname)
'Call Get IPAddress
Console.WriteLine("Your IP = " & GetIPAddress())
TextBox1.Text = shostname
TextBox2.Text = "" & GetIPAddress()
End Sub
Shared Function GetIPAddress() As String
Dim oAddr As System.Net.IPAddress
Dim sAddr As String
With System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName())
oAddr = New System.Net.IPAddress(.AddressList(0).Address)
sAddr = oAddr.ToString
End With
GetIPAddress = sAddr
End Function
Enjoy

New Topic/Question
Reply



MultiQuote





|