473,397 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

get ip address of this pc with windows app

cj
How can a windows app get the ip address of the machine it is running
on? vb 2005
Mar 15 '07 #1
3 2691
CJ,

This is how to get the internal IP address:

Imports System.Net

Dim ipAddress As IPHostEntry = Dns.GetHostByName(Dns.GetHostName)
Me.Text = ipAddress.AddressList.GetValue(0).ToString

I hope this helps,

--
Newbie Coder
(It's just a name)
Mar 15 '07 #2
cj
had to change it a bit but it works

Dim ipAddressInfo As IPHostEntry = Dns.GetHostEntry(Dns.GetHostName())
Dim ipAddress As String = ipAddressInfo.AddressList.GetValue(0).ToString
Newbie Coder wrote:
CJ,

This is how to get the internal IP address:

Imports System.Net

Dim ipAddress As IPHostEntry = Dns.GetHostByName(Dns.GetHostName)
Me.Text = ipAddress.AddressList.GetValue(0).ToString

I hope this helps,
Mar 16 '07 #3
Hi CJ,

You're right that Dns.GetHostByName is obsolete in .NET 2.0,
Dns.GetHostEntry should be used instead.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 20 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: johny smith | last post by:
I am trying to figure out a way to print the address of what called a certain function once inside the function. I am assuming that this information is on the stack somewhere. But can someone...
1
by: Steve Guidos | last post by:
We are writing a set of Windows Services using C#.NET that will run on the same server. One of the developers here said that we should assign each service its own Base Address using the Properties...
12
by: greg_chu | last post by:
Hi, I know I can use ipconfig.exe is DOS to get my IP address, the situation is I need to automat this process. I need to write a DOS program which issue a command to run IPCONFIG to get the IP...
12
by: lmcleroy | last post by:
I'm new around here so I'm just hoping I'm in the correct place. Today I installed the latest Python for windows (2.5.1) from python.org. That went well but I lost my internet and home network...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.