473,805 Members | 2,164 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Finding IP address

hi, im making a program that uses the IP address of the computer its on, but
i dont kno how to programmaticly find it.....can anyone point me in the rite
direction? thanks
--
-iwdu15
Nov 21 '05 #1
10 1421
Imports System.Net

Dim HostIP As IPAddress
HostIP = Dns.GetHostByNa me(Dns.GetHostN ame).AddressLis t.GetValue(0)

Rgds, Phil

"iwdu15" <iw****@discuss ions.microsoft. com> wrote in message
news:B6******** *************** ***********@mic rosoft.com...
hi, im making a program that uses the IP address of the computer its on,
but
i dont kno how to programmaticly find it.....can anyone point me in the
rite
direction? thanks
--
-iwdu15

Nov 21 '05 #2
awsome thank you
Nov 21 '05 #3
and if the computer is behind a router, is there a way to know the
public(Internet ) IP?

thanks

"Phil G." <Ph**@nospam.co m> a écrit dans le message de
news:de******** **@nwrdmz01.dmz .ncs.ea.ibs-infra.bt.com...
Imports System.Net

Dim HostIP As IPAddress
HostIP = Dns.GetHostByNa me(Dns.GetHostN ame).AddressLis t.GetValue(0)

Rgds, Phil

"iwdu15" <iw****@discuss ions.microsoft. com> wrote in message
news:B6******** *************** ***********@mic rosoft.com...
hi, im making a program that uses the IP address of the computer its on,
but
i dont kno how to programmaticly find it.....can anyone point me in the
rite
direction? thanks
--
-iwdu15


Nov 21 '05 #4
Hi,

http://www.windowsformsdatagridhelp....f-a311e93c13c3

Ken
-----------------------
"ThunderMus ic" <NO*******@symp atico.caSPAMATA LL> wrote in message
news:e4******** ******@TK2MSFTN GP15.phx.gbl...
and if the computer is behind a router, is there a way to know the
public(Internet ) IP?

thanks

"Phil G." <Ph**@nospam.co m> a écrit dans le message de
news:de******** **@nwrdmz01.dmz .ncs.ea.ibs-infra.bt.com...
Imports System.Net

Dim HostIP As IPAddress
HostIP = Dns.GetHostByNa me(Dns.GetHostN ame).AddressLis t.GetValue(0)

Rgds, Phil

"iwdu15" <iw****@discuss ions.microsoft. com> wrote in message
news:B6******** *************** ***********@mic rosoft.com...
hi, im making a program that uses the IP address of the computer its on,
but
i dont kno how to programmaticly find it.....can anyone point me in the
rite
direction? thanks
--
-iwdu15



Nov 21 '05 #5
Here is the same but in c#

using System.Net;
//
IPHostEntry o = Dns.GetHostByNa me( Dns.GetHostName () );
MessageBox.Show ("Your IP address is : " +o.AddressList[0] );

good luck !

craig kelly-soens - Windows Vista WinFx XAML .Net Evangelist
http://www.XpectWorld.com - customised "super-easy to use" Windows Vista
based software & consultancy
Jan 28 '06 #6
Is there a way to programatically get the router IP address, if the LAN is on
a router?
--
Michael Bragg, President
eSolTec, Inc.
a 501(C)(3) organization
MS Authorized MAR
looking for used laptops for developmentally disabled.
"Ken Tucker [MVP]" wrote:
Hi,

http://www.windowsformsdatagridhelp....f-a311e93c13c3

Ken
-----------------------
"ThunderMus ic" <NO*******@symp atico.caSPAMATA LLwrote in message
news:e4******** ******@TK2MSFTN GP15.phx.gbl...
and if the computer is behind a router, is there a way to know the
public(Internet ) IP?

thanks

"Phil G." <Ph**@nospam.co ma écrit dans le message de
news:de******** **@nwrdmz01.dmz .ncs.ea.ibs-infra.bt.com...
Imports System.Net

Dim HostIP As IPAddress
HostIP = Dns.GetHostByNa me(Dns.GetHostN ame).AddressLis t.GetValue(0)

Rgds, Phil

"iwdu15" <iw****@discuss ions.microsoft. comwrote in message
news:B6******** *************** ***********@mic rosoft.com...
hi, im making a program that uses the IP address of the computer its on,
but
i dont kno how to programmaticly find it.....can anyone point me in the
rite
direction? thanks
--
-iwdu15

Sep 8 '06 #7
You could get it from WMI.

WIN32_NetworkAd apterConfigurat ion.DefaultIpGa teway
"eSolTec, Inc. 501(c)(3)" <es*****@noemai l.nospamwrote in message
news:9A******** *************** ***********@mic rosoft.com...
Is there a way to programatically get the router IP address, if the LAN is
on
a router?
--
Michael Bragg, President
eSolTec, Inc.
a 501(C)(3) organization
MS Authorized MAR
looking for used laptops for developmentally disabled.
"Ken Tucker [MVP]" wrote:
>Hi,

http://www.windowsformsdatagridhelp....f-a311e93c13c3

Ken
-----------------------
"ThunderMusi c" <NO*******@symp atico.caSPAMATA LLwrote in message
news:e4******* *******@TK2MSFT NGP15.phx.gbl.. .
and if the computer is behind a router, is there a way to know the
public(Interne t) IP?

thanks

"Phil G." <Ph**@nospam.co ma écrit dans le message de
news:de******* ***@nwrdmz01.dm z.ncs.ea.ibs-infra.bt.com...
Imports System.Net

Dim HostIP As IPAddress
HostIP = Dns.GetHostByNa me(Dns.GetHostN ame).AddressLis t.GetValue(0)

Rgds, Phil

"iwdu15" <iw****@discuss ions.microsoft. comwrote in message
news:B6******** *************** ***********@mic rosoft.com...
hi, im making a program that uses the IP address of the computer its
on,
but
i dont kno how to programmaticly find it.....can anyone point me in
the
rite
direction? thanks
--
-iwdu15



Sep 8 '06 #8
Hi

I agree Terry's suggestion, here I provide the code snippet for your
reference.

'NOTE: You need add reference to System.Manageme nt.dll first.
Dim mc As System.Manageme nt.ManagementCl ass
Dim mo As ManagementObjec t
mc = New ManagementClass ("Win32_Network AdapterConfigur ation")
Dim moc As ManagementObjec tCollection = mc.GetInstances ()
For Each mo In moc
If mo.Item("IPEnab led") = True Then
Debug.WriteLine ("Network Adapter MAC address " &
mo.Item("MacAdd ress").ToString ())
Debug.WriteLine ("Gateway(Rount er): ")
Dim ss() As String = mo.Item("Defaul tIpGateway")
For Each s As String In ss
Debug.WriteLine (" " + s)
Next
End If
Next

You may have a try, and if you have other concern, please feel free to let
me know.

Best regards,

Peter Huang

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.

Sep 8 '06 #9
Peter,

Thank you for your code snippet. It is greatly appreciated. Now I'm
wondering how to get the information from the Immediate window into a label
container :) please
--
Michael Bragg, President
eSolTec, Inc.
a 501(C)(3) organization
MS Authorized MAR
looking for used laptops for developmentally disabled.
""Peter Huang" [MSFT]" wrote:
Hi

I agree Terry's suggestion, here I provide the code snippet for your
reference.

'NOTE: You need add reference to System.Manageme nt.dll first.
Dim mc As System.Manageme nt.ManagementCl ass
Dim mo As ManagementObjec t
mc = New ManagementClass ("Win32_Network AdapterConfigur ation")
Dim moc As ManagementObjec tCollection = mc.GetInstances ()
For Each mo In moc
If mo.Item("IPEnab led") = True Then
Debug.WriteLine ("Network Adapter MAC address " &
mo.Item("MacAdd ress").ToString ())
Debug.WriteLine ("Gateway(Rount er): ")
Dim ss() As String = mo.Item("Defaul tIpGateway")
For Each s As String In ss
Debug.WriteLine (" " + s)
Next
End If
Next

You may have a try, and if you have other concern, please feel free to let
me know.

Best regards,

Peter Huang

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.

Sep 8 '06 #10

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

Similar topics

11
2209
by: Picture Dots | last post by:
Ok - I want to check a string for @ in it (Im checking to see if a string that should contain an email holds a @ ) How would I go about this? preg_match? ereg? strstr?Examples? Also - how would I find any non alpha numeric characters in a string so I can give the user an error message. I dont want any characters besides alpha-numeric in the strings.
2
7133
by: Antitax | last post by:
I have a database with more than 800 adress records Some of the are similar because some letters in the street adress for example are not identical, altough they point to the same adress. Does anyone have the syntax for a query that shows similar adresses thar could be duplicates? Thank you
9
1716
by: Lauren Wilson | last post by:
Hi Folks, We've been using Crypto ++32 to control licensed access to our widely distributed Access 2K app. Unfortunately, Sampson Multimedia appears to be out of business. Does anyone out there have recommendations for an alternate method of locking our MDE files to allow only licensed access? We simply want to allow the user to install the program and get a
2
3290
by: FR3AK | last post by:
Hi. does anyone have any idea of how to find the mac address of a remote networking device? I've worked with WMI and it works fine as long as the target machine is a Windows computer, however, i want to return the MAC address of ANY IP device on my network. right now, i have a totally inefficient way to return a mac address, but it's only by dropping to a command prompt and executing the ARP command (all within code....it's not as...
1
1230
by: | last post by:
Hello, I'm keping myself busy here by investigating the world of LDAP and Active Directory. I have an application which allows users from the system to be selected from a list box and as a result their mail address (as set in AD) is returned. This is all fine untill I try to show the address of a user who doesn't have one. In esscense, the DirectorySearcher.FindAll isn't finding any. Here's a copy of what I have:
2
1831
by: Lad | last post by:
Did anyone try to find out a regular expression for finding an email address in a text? Thank you for the reply L.
11
26306
by: axlq | last post by:
Does anyone have a favored way of finding the geographic location of a user's IP address, so that a php script can include content relevant to that location? Reverse-lookup of the hostname isn't reliable and often doesn't work, especially if the returned hostname ends with .com, .net, ..info, .biz or other tld that doesn't reveal geographic location. I also see a bunch of commercial services that offer a "country whois" function for a...
17
3792
by: abhimanyu.v | last post by:
Hi Guys, I have one doubt. The test program is given below. It uses two way of finding out the offset of a variable in structure. I executed the program and found the same result. My question is what is difference between 1) (unsigned long) &((struct foobar *)0)->foo and
5
2064
by: Timothy Grant | last post by:
On Tue, Aug 5, 2008 at 2:50 PM, David York <davideyork@gmail.comwrote: I'm not sure what you are trying to accomplish. The machine I'm typing this on has a 192.168.x.x number. The router that gave it to me also has a 192.168.x.x number. However, I know that that is not the IP that the world sees when my packets finally leave the building. What if your machine has multiple interface cards in it? What are you trying to accomplish?
275
12436
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
10613
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10107
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7649
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5544
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3846
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.