Local IP Address Finder - Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This tutorial will show you how to find out the IP Address.

Add a button to the form, and change it's text to Get IP:

Visual Basic 2008 IP Finder

Add a Label and a TextBox to the form. Change the label text to IP Address:

Visual Basic 2008 Get IP

We will add one control that is not included in the toolbox:

On the Toolbox: right click the mouse and click on Choose Items...:

Visual Basic 2008 Add WinSock

A Window will appear: Click on COM Components.

Scroll down to Microsoft WinSock Control, version 6.0 and check it.

Visual Basic 2008 Add WinSock


Click OK. This will add the WinSock control to the ToolBox:

Visual Basic 2008 WinSock

Drag the WinSock Control the Form:

Visual Basic 2008 IP Address Finder

Add the following code that handles the button click event to retrieve the ip address

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = AxWinsock1.LocalIP
    End Sub    

Run the program and click on Get IP button. Your IP Address should appear inside the text box:

Visual Basic 2008 Local IP Address

Share This

Home | About | Contact | Privacy Policy

Copyright visual-basic-tutorials.com 2018 - All Rights Reserved.