PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VS 2008 Is it possible to get my network users' local IP?-VBForums
Results 1 to 7 of 7

Thread: Is it possible to get my network users' local IP?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Is it possible to get my network users' local IP?

    Hi again!


    Is it possible to get all my network users' local IPs using VB 2008?
    Last edited by rami0; Jul 9th, 2011 at 09:43 AM.

  2. #2
    Hyperactive Member DavesChillaxin's Avatar
    Join Date
    Mar 2011
    Location
    WNY
    Posts
    451

    Re: Is it possible to get my network users' local IP?

    This worked for me, a green squiggly line appears but still works.

    Pretty self explanatory too.

    Code:
    Imports System.Net
    
    Public Class Form1
    
        Private Sub Form1_Load( ByVal sender As System.Object,  ByVal e As System.EventArgs) Handles MyBase.Load
            Dim h As System.Net.IPHostEntry = Dns.GetHostByName(Dns.GetHostName)
    
            TextBox1.Text = h.AddressList.GetValue(0).ToString 
        End Sub
    End Class
    Last edited by DavesChillaxin; Jul 9th, 2011 at 11:50 AM.
    Please rate if my post was helpful!
    Per favore e grazie!




    Code Bank:
    Advanced Algebra Class *Update | True Gradient Label Control *Dev | A Smarter TextBox *Update | Register Global HotKey *Update
    Media Library Beta *Dev | Mouse Tracker (Available in VB.net and C#.net) *New | On-Screen Numpad (VB.net) *New

  3. #3
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    629

    Re: Is it possible to get my network users' local IP?

    Same idea, only without the wiggly line.
    vb Code:
    1. Public Shared ReadOnly Property CurrentIPs() As String()
    2.         Get
    3.             Dim ips As New List(Of String)
    4.             Dim addresses() As Net.IPAddress = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName).AddressList
    5.             For i As Integer = addresses.Count / 2 To addresses.Count - 1
    6.                 ips.Add(addresses(i).ToString)
    7.             Next
    8.             Return ips.ToArray
    9.         End Get
    10.     End Property

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: Is it possible to get my network users' local IP?

    Quote Originally Posted by bergerkiller View Post
    Same idea, only without the wiggly line.
    vb Code:
    1. Public Shared ReadOnly Property CurrentIPs() As String()
    2.         Get
    3.             Dim ips As New List(Of String)
    4.             Dim addresses() As Net.IPAddress = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName).AddressList
    5.             For i As Integer = addresses.Count / 2 To addresses.Count - 1
    6.                 ips.Add(addresses(i).ToString)
    7.             Next
    8.             Return ips.ToArray
    9.         End Get
    10.     End Property
    And how to show them in a textbox?

  5. #5
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Pointless Forest 38.517,-92.023
    Posts
    9,265

    Re: Is it possible to get my network users' local IP?

    Quote Originally Posted by rami0 View Post
    Hi again!


    Is it possible to get all my network users' local IPs using VB 2008?
    What is network user?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  6. #6
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    629

    Re: Is it possible to get my network users' local IP?

    Line by line?
    Code:
    Dim ips As String = ""
    For Each ip As String In CurrentIPs
        ips &= ip & VbCrlf
    Next
    TextBox1.Text = ips.Trim()
    And yep, if you mean other users connected to your (small) network you need a different type of code; my code only displays the IPs (adapter IPs) of the user.

  7. #7
    Hyperactive Member DavesChillaxin's Avatar
    Join Date
    Mar 2011
    Location
    WNY
    Posts
    451

    Re: Is it possible to get my network users' local IP?

    Quote Originally Posted by bergerkiller View Post
    Same idea, only without the wiggly line.
    vb Code:
    1. Public Shared ReadOnly Property CurrentIPs() As String()
    2.         Get
    3.             Dim ips As New List(Of String)
    4.             Dim addresses() As Net.IPAddress = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName).AddressList
    5.             For i As Integer = addresses.Count / 2 To addresses.Count - 1
    6.                 ips.Add(addresses(i).ToString)
    7.             Next
    8.             Return ips.ToArray
    9.         End Get
    10.     End Property
    Nice, duly noted.
    Please rate if my post was helpful!
    Per favore e grazie!




    Code Bank:
    Advanced Algebra Class *Update | True Gradient Label Control *Dev | A Smarter TextBox *Update | Register Global HotKey *Update
    Media Library Beta *Dev | Mouse Tracker (Available in VB.net and C#.net) *New | On-Screen Numpad (VB.net) *New

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width