• We just launched and are currently in beta. Join us as we build and grow the community.

How to Get Local Ip Address(IPv6) in VB.Net

TheRise

Blue Team Defender
T Rep
0
0
0
Rep
0
T Vouches
0
0
0
Vouches
0
Posts
59
Likes
99
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 200 XP
In this tutorial, I will teach you how to get the local ip address using visual basic 2015. This method has the capacity to retrieve the local ip address (ipv6) and will be displayed in the listbox. This application is similar to The Easiest Way to Get Local Ip Address (IPv4) in VB.Net. Let’s begin

Creating Application

Step 1

Open Microsoft Visual Studio 2015 and create a new windows form application for visual basic.
creating_vb_15.png

Step 2

Do the form just like shown below
ps_ipv6.png

Step 3

Open the code editor and set the Imports System.Net to access

the .net libraries. You can put this above the public class.
Step 4

Create a sub procedure for getting the local ip address.

  1. Private

    Sub

    retrieve_ipv6()

  2. Dim

    host_name As

    String

    = Dns.GetHostName()

  3. Dim

    ip_address As

    String

    = Dns.GetHostEntry(host_name).AddressList(0).ToString()
  4. Dim

    h As

    System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName)


  5. ListBox1.Items.Add("Host: "

    & host_name & "; IP Address: "

    & ip_address)

  6. End

    Sub

Step 5

Do the following code for showing the ip address in the list box when the button is clicked.
  1. Private

    Sub

    Button1_Click(sender As

    Object

    , e As

    EventArgs) Handles Button1.Click
  2. retrieve_ipv6()
  3. End

    Sub

For any questions about this article. You can contact me @
Email – [email protected]
Mobile No. – 09305235027 – TNT
Or feel free to comment below.

 

452,292

323,526

323,535

Top