473,382 Members | 1,329 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,382 software developers and data experts.

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 1394
Imports System.Net

Dim HostIP As IPAddress
HostIP = Dns.GetHostByName(Dns.GetHostName).AddressList.Get Value(0)

Rgds, Phil

"iwdu15" <iw****@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.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.com> 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.GetHostByName(Dns.GetHostName).AddressList.Get Value(0)

Rgds, Phil

"iwdu15" <iw****@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.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
-----------------------
"ThunderMusic" <NO*******@sympatico.caSPAMATALL> wrote in message
news:e4**************@TK2MSFTNGP15.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.com> 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.GetHostByName(Dns.GetHostName).AddressList.Get Value(0)

Rgds, Phil

"iwdu15" <iw****@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.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.GetHostByName( 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
-----------------------
"ThunderMusic" <NO*******@sympatico.caSPAMATALLwrote in message
news:e4**************@TK2MSFTNGP15.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.coma écrit dans le message de
news:de**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Imports System.Net

Dim HostIP As IPAddress
HostIP = Dns.GetHostByName(Dns.GetHostName).AddressList.Get Value(0)

Rgds, Phil

"iwdu15" <iw****@discussions.microsoft.comwrote in message
news:B6**********************************@microsof t.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_NetworkAdapterConfiguration.DefaultIpGateway
"eSolTec, Inc. 501(c)(3)" <es*****@noemail.nospamwrote in message
news:9A**********************************@microsof t.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
-----------------------
"ThunderMusic" <NO*******@sympatico.caSPAMATALLwrote in message
news:e4**************@TK2MSFTNGP15.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.coma écrit dans le message de
news:de**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Imports System.Net

Dim HostIP As IPAddress
HostIP = Dns.GetHostByName(Dns.GetHostName).AddressList.Get Value(0)

Rgds, Phil

"iwdu15" <iw****@discussions.microsoft.comwrote in message
news:B6**********************************@microsof t.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.Management.dll first.
Dim mc As System.Management.ManagementClass
Dim mo As ManagementObject
mc = New ManagementClass("Win32_NetworkAdapterConfiguration ")
Dim moc As ManagementObjectCollection = mc.GetInstances()
For Each mo In moc
If mo.Item("IPEnabled") = True Then
Debug.WriteLine("Network Adapter MAC address " &
mo.Item("MacAddress").ToString())
Debug.WriteLine("Gateway(Rounter): ")
Dim ss() As String = mo.Item("DefaultIpGateway")
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.Management.dll first.
Dim mc As System.Management.ManagementClass
Dim mo As ManagementObject
mc = New ManagementClass("Win32_NetworkAdapterConfiguration ")
Dim moc As ManagementObjectCollection = mc.GetInstances()
For Each mo In moc
If mo.Item("IPEnabled") = True Then
Debug.WriteLine("Network Adapter MAC address " &
mo.Item("MacAddress").ToString())
Debug.WriteLine("Gateway(Rounter): ")
Dim ss() As String = mo.Item("DefaultIpGateway")
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
Hi Michael,

For the other Debug.Print, it is simple.
Change the Debug.WriteLine to LabelX.Text =

For the code below.
For Each s As String In ss
Debug.WriteLine(" " + s)
Next
We need to decided how many labels or which element we want in the ss
string array.
e.g.
If ss.Length 1 Then
Label1.Text = ss(0)
End If

You may have a try and let me know the result. :)

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 11 '06 #11

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

Similar topics

11
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...
2
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...
9
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...
2
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,...
1
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...
2
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
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...
17
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...
5
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...
275
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'
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.