I can get my DNS Name, Machine Name and User Name like
MessageBox.Show("NetBIOS Name: " & System.Environment.MachineName &
vbCrLf & _
"DNS Name: " & System.Net.Dns.GetHostByName("LocalHost").HostName &
vbCrLf & _
"User Name: " & System.Environment.UserName)
how can I display my IP address?
Also, what is the difference between a DNS Name and a NetBIOS name? 11 22838
Public Function Get_LocalIPAddress() As String
Dim h As System.Net.IPHostEntry =
System.Net.Dns.GetHostEntry(System.Net.Dns.GetHost Name)
'return any string found
Get_LocalIPAddress = CType(h.AddressList.GetValue(0),
System.Net.IPAddress).ToString
End Function
"cj" <cj@nospam.nospam> wrote in message
news:eS**************@TK2MSFTNGP04.phx.gbl... I can get my DNS Name, Machine Name and User Name like
MessageBox.Show("NetBIOS Name: " & System.Environment.MachineName & vbCrLf & _ "DNS Name: " & System.Net.Dns.GetHostByName("LocalHost").HostName & vbCrLf & _ "User Name: " & System.Environment.UserName)
how can I display my IP address?
Also, what is the difference between a DNS Name and a NetBIOS name?
Sam,
Maybe we should use System.Net.Dns.Resolve(System.Net.Dns.GetHostName)
instead of
System.Net.Dns.GetHostEntry(System.Net.Dns.GetHost Name).
Peter
"Sam Malone" <th************@hotmail.com>
wrote:#7**************@TK2MSFTNGP02.phx.gbl... Public Function Get_LocalIPAddress() As String
Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHost Name)
'return any string found
Get_LocalIPAddress = CType(h.AddressList.GetValue(0), System.Net.IPAddress).ToString
End Function
Go for it and I'd appreciate hearing which is better (if indeed one is
better than the other)
"Peter" <zl*****@sina.com> wrote in message
news:ed**************@TK2MSFTNGP04.phx.gbl... Sam,
Maybe we should use System.Net.Dns.Resolve(System.Net.Dns.GetHostName) instead of System.Net.Dns.GetHostEntry(System.Net.Dns.GetHost Name).
Peter
"Sam Malone" <th************@hotmail.com> wrote:#7**************@TK2MSFTNGP02.phx.gbl... Public Function Get_LocalIPAddress() As String
Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHost Name)
'return any string found
Get_LocalIPAddress = CType(h.AddressList.GetValue(0), System.Net.IPAddress).ToString
End Function
GetHostEntry is not a member of System.Net.Dns
Perhaps it's because I'm using VS2003?
Sam Malone wrote: Public Function Get_LocalIPAddress() As String
Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHost Name)
'return any string found
Get_LocalIPAddress = CType(h.AddressList.GetValue(0), System.Net.IPAddress).ToString
End Function
"cj" <cj@nospam.nospam> wrote in message news:eS**************@TK2MSFTNGP04.phx.gbl... I can get my DNS Name, Machine Name and User Name like
MessageBox.Show("NetBIOS Name: " & System.Environment.MachineName & vbCrLf & _ "DNS Name: " & System.Net.Dns.GetHostByName("LocalHost").HostName & vbCrLf & _ "User Name: " & System.Environment.UserName)
how can I display my IP address?
Also, what is the difference between a DNS Name and a NetBIOS name?
I don't get an IP address. That gives me:
? System.Net.Dns.Resolve(System.Net.Dns.GetHostName)
{System.Net.IPHostEntry}
AddressList: {Length=1}
Aliases: {Length=0}
HostName: "CJ"
I'm using VS2003 if that changes things. I should have mentioned it.
Peter wrote: Sam,
Maybe we should use System.Net.Dns.Resolve(System.Net.Dns.GetHostName) instead of System.Net.Dns.GetHostEntry(System.Net.Dns.GetHost Name).
Peter
"Sam Malone" <th************@hotmail.com> wrote:#7**************@TK2MSFTNGP02.phx.gbl... Public Function Get_LocalIPAddress() As String
Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHost Name)
'return any string found
Get_LocalIPAddress = CType(h.AddressList.GetValue(0), System.Net.IPAddress).ToString
End Function
Could be. It works "as is" for me in VS2005
"cj" <cj@nospam.nospam> wrote in message
news:uB**************@TK2MSFTNGP04.phx.gbl... GetHostEntry is not a member of System.Net.Dns
Perhaps it's because I'm using VS2003?
Sam Malone wrote: Public Function Get_LocalIPAddress() As String
Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHost Name)
'return any string found
Get_LocalIPAddress = CType(h.AddressList.GetValue(0), System.Net.IPAddress).ToString
End Function
"cj" <cj@nospam.nospam> wrote in message news:eS**************@TK2MSFTNGP04.phx.gbl... I can get my DNS Name, Machine Name and User Name like
MessageBox.Show("NetBIOS Name: " & System.Environment.MachineName & vbCrLf & _ "DNS Name: " & System.Net.Dns.GetHostByName("LocalHost").HostName & vbCrLf & _ "User Name: " & System.Environment.UserName)
how can I display my IP address?
Also, what is the difference between a DNS Name and a NetBIOS name?
Hi cj,
Thanks for your feedback!
You can get the IP address like this:
private void button1_Click(object sender, System.EventArgs e)
{
IPHostEntry hostInfo = Dns.GetHostByName("host name");
byte[] ipaddr=hostInfo.AddressList[0].GetAddressBytes();
MessageBox.Show("IP Address:
"+ipaddr[0]+"."+ipaddr[1]+"."+ipaddr[2]+"."+ipaddr[3]+"\n");
}
This code snippet works well on my side. Hope this helps!
Best regards,
Jeffrey Tan
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.
Jeffrey,
I had to smile, but it is true, be aware that this is a VB Net newsgroup and
that your code can look confusing for some people searching this newsgroup.
Cor
""Jeffrey Tan[MSFT]"" <je***@online.microsoft.com> schreef in bericht
news:CD**************@TK2MSFTNGXA01.phx.gbl... Hi cj,
Thanks for your feedback!
You can get the IP address like this: private void button1_Click(object sender, System.EventArgs e) { IPHostEntry hostInfo = Dns.GetHostByName("host name"); byte[] ipaddr=hostInfo.AddressList[0].GetAddressBytes(); MessageBox.Show("IP Address: "+ipaddr[0]+"."+ipaddr[1]+"."+ipaddr[2]+"."+ipaddr[3]+"\n"); }
This code snippet works well on my side. Hope this helps!
Best regards, Jeffrey Tan 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.
Oh, yes, it seems that I mislooked the queue name :-(
Anyway, a C# to VB.net converter can help here: http://www.developerfusion.co.uk/uti...sharptovb.aspx
Best regards,
Jeffrey Tan
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.
The converter doesn't work exactly but close enough. Because I want to
know the ip address of the machine this is running on and don't want to
have to hard code the computers name in the code I changed the dim
hostinfo line as shown below. Thanks for the code.
Dim hostInfo As System.Net.IPHostEntry = _
System.Net.Dns.GetHostByName(System.Net.Dns.GetHos tByName("LocalHost").HostName)
Dim ipaddr As Byte() = hostInfo.AddressList(0).GetAddressBytes
MessageBox.Show("IP Address:" & ipaddr(0) & "." & ipaddr(1) & "." & _
ipaddr(2) & "." & ipaddr(3) & "" & Microsoft.VisualBasic.Chr(10) & "")
Jeffrey Tan[MSFT] wrote: Oh, yes, it seems that I mislooked the queue name :-(
Anyway, a C# to VB.net converter can help here: http://www.developerfusion.co.uk/uti...sharptovb.aspx
Best regards, Jeffrey Tan 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.
Hi cj,
I am glad you have figured out what you need. If you need further help,
please feel free to post. Thanks.
Best regards,
Jeffrey Tan
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Shinin |
last post by:
I am trying to set up a mailto: link so that the actual address that
the email is being sent to is obscured and replaced by a name. For
example, I have <a href="mailto:jschmoe@abc.com">Joe...
|
by: Mat |
last post by:
<div id="container">
<div id="main">
<div id="header">
<p class="Address">123 Fake Street, </p>
<p class="City">Crazy City, </p>
<p class="Province">Ontario </p>
<p class="PostalCode">H0H...
|
by: DettCom |
last post by:
Hello,
I would like to be able to display or hide fields based on whether a
specific Yes/No radio button is selected. This is in conjunction with
a posting a just made here in the same group...
|
by: dmiller23462 |
last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript
but my end result is I need two text boxes to stay hidden until a
particular option is selected....I've cobbled together the...
|
by: MRBEATZ |
last post by:
I'm new to this group on here, but I wanted to know if anyone knows how to
display an IP address using javascript. Thanks in advance.
Randy
| |
by: Kevin Newman |
last post by:
Does anyone know of any application (AJAX or other) that will display
the appropriate address for for the selected (or detected) country?
If not, does anyone know where I can find a list or...
|
by: HarisHohkl |
last post by:
Hi, I've this function in a class to update the total value.but when i try to remove the these row highlight in Bold it crash, what should i do????
void display_total_value()
{
double...
|
by: fiversen |
last post by:
Hello,
I have a site for the collegue with a football winning game.
...fussball.html
there I redirect the user to an cgi-page
../f11.cgi
|
by: Gordon Allott |
last post by:
Hello :)
The result of various incompatibilities has left me needing to somehow
extract the address that a null pointer is pointing to with the null
pointer being exposed to python via...
|
by: alexandrus |
last post by:
Hello,
I have a problem. I have a email stored in database in fields (e.g. AddressLine1, Postal Code, Zip .. e.t.c.) I need a solution to display address to user in selected country format. It...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 ...
|
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...
| |