Results 1 to 4 of 4

Thread: Automatically Detect IP address of compter? *RESOLVED - Thank You*

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2004
    Location
    Kansas, USA
    Posts
    352

    Automatically Detect IP address of compter? *RESOLVED - Thank You*

    Is there a way using VB.NET to detect the IP address of the computer the app is running on so that I can avoid prompting a user or hardcoding the IP address into the app?

    Thanks,
    Eric
    Last edited by flycast; Jul 16th, 2004 at 10:53 AM.

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    This will get the local ip address of the machine.

    VB Code:
    1. Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         Dim dns As System.Net.Dns
    3.         Me.Text = dns.Resolve(SystemInformation.ComputerName).AddressList(0).ToString()
    4.  
    5.     End Sub

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2004
    Location
    Kansas, USA
    Posts
    352
    Thank you!
    That works.
    I appreciate your help.
    Eric

  4. #4
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Just so you know that it gets the LOCAL ip... I stress that again, because if the computer is behind a router, it will use the ip assigned to it by the router, not the external IP the rest of the world sees.

Posting Permissions

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



Click Here to Expand Forum to Full Width