자신 ip주소 가져오기

VNote 2017.06.11 07:32:20 *: Imports System.Net

Public Class Form1
Dim hostname
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
ShowMyIP()
End Sub

Private Sub ShowMyIP()
Dim ip As String
Dim ip2 As String
Dim h As System.Net.IPHostEntry = Nothing
h = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName)
ip = h.AddressList.GetValue(0).ToString
ip2 = h.AddressList.GetValue(2).ToString
Label1.Text = ip
Label2.Text = ip2
End Sub


End Class

캡처.PNG