James,
As Herfried suggests: add "Imports System.Net" at the top of the module. Or
simply use:
Dim address As System.Net.IPAddress
If it still errors, verify you have you have a reference (Project -
Properties - References) to the System.dll assembly. VB normally always
references the System.dll so that should not be a problem.
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
"james" <jjames700ReMoVeMe at earthlink dot net> wrote in message
news:OO**************@tk2msftngp13.phx.gbl...
| Jay, I just tried your example and I get an error on the line: Dim address
as IPAddress and the tooltip shows
| Type Expected ). Not sure what that means, if I add a decimal after the
IPAddress the dropdown only shows Form1. I added:
| Imports System.Net.IPAddress at the top and it still does that.
| Just thought I would let you know.
| james
|
|
| "Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net> wrote in
message news:%2****************@tk2msftngp13.phx.gbl...
| > Jason,
| > In addition to the other comments, I would recommend using
| > System.Net.IPAddress to hold & parse the IP address itself.
| >
| > Then you can use IPAddress.GetAddressBytes to get the individual bytes
of
| > the address allowing your routine to work for both IP4 (192.168.2.10)
and
| > IP6 (0:0:0:0:0:0:0:1) addresses.
| >
| > Something like:
| >
| > Dim address As IPAddress
| >
| > address = IPAddress.Parse("192.168.2.10") ' sample IP4
| > address = IPAddress.Parse("0:0:0:0:0:0:0:1") ' sample IP6
| >
| > Dim bytes() As Byte = address.GetAddressBytes()
| > Dim value As New System.Text.StringBuilder()
| > For index As Integer = 0 To bytes.Length - 1
| > value.Append(Convert.ToString(bytes(index), 2).PadLeft(8,
"0"c))
| > value.Append(" "c)
| > Next
| > value.Length -= 1 ' trim trailing space
| > Debug.WriteLine(address.ToString())
| > Debug.WriteLine(value.ToString())
| >
| >
| > --
| > Hope this helps
| > Jay [MVP - Outlook]
| > .NET Application Architect, Enthusiast, & Evangelist
| > T.S. Bradley -
http://www.tsbradley.net
| >
| >
| > "Jason" <no**@none.invalid> wrote in message
| > news:e9**************@TK2MSFTNGP12.phx.gbl...
| > | Could someone here show me how I would write a vb program to convert
| > decimal
| > | ip address to binary?
| > |
| > | For example a small form with a convert button and a label for the
result
| > | and a textbox for the ip.
| > |
| > | So I would want 11000000 10101000 00000010 00001010 tp show up
inthe
| > | label if I entered 192.168.2.10 into the text box.
| > |
| > | I have no idea even how to begin this, any help would be great.
| > |
| > |
| >
| >
|
|