What predefined type is this....


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: What predefined type is this....

  1. #1
    hehe Guest

    What predefined type is this....

    Hi, I keep getting an error in the debugging process when I enter in an ip
    address in the console (most likely because of the dots between the
    numbers), so I tried for the sake of trying, double, int, and decimal none
    of which would work and i got the point. Can anyone show me how i can enter
    in an ip address in a way that the program can actually make use of it and
    that I wont get an error?
    Thank you in advance!



  2. #2
    Zane Thomas Guest

    Re: What predefined type is this....

    On Sun, 14 Jul 2002 18:11:45 -0400, "hehe" <1324@1324.com> wrote:

    >Can anyone show me how i can enter
    >in an ip address in a way that the program can actually make use of it and
    >that I wont get an error?


    One of the easy ways is to enter a dotted string, like this:

    123.123.123.123

    you would then use IPAddress.Parse() to convert it to a long having the
    correct byte order.

    So, something like this:

    IPAddress foo;
    string s;

    s = Console.ReadLine();
    foo = IPAddress.Parse(s);


    --

    *--------={ Fine Art for .NET }=--------*
    | .Net Components @ www.abderaware.com |
    *---------------------------------------*

    Turn on, tune in, download.
    zane a@t abderaware.com

  3. #3
    Zane Thomas Guest

    Re: What predefined type is this....


    Randy,

    Please don't reply to newsgroup posts with email. You probably haven't
    included a 'using System.Net;' statement.


    I got an error when i tried that, it said IPAdress was not a member of the
    namespace. Is there some kind of system function i should use like "using
    System......;"?


    ----- Original Message -----
    From: "Zane Thomas" <zane@abderaware.com>
    Newsgroups: csharp.general
    Sent: Sunday, July 14, 2002 6:20 PM
    Subject: Re: What predefined type is this....


    > On Sun, 14 Jul 2002 18:11:45 -0400, "hehe" <1324@1324.com> wrote:
    >
    > >Can anyone show me how i can enter
    > >in an ip address in a way that the program can actually make use of it

    and
    > >that I wont get an error?

    >
    > One of the easy ways is to enter a dotted string, like this:
    >
    > 123.123.123.123
    >
    > you would then use IPAddress.Parse() to convert it to a long having the
    > correct byte order.
    >
    > So, something like this:
    >
    > IPAddress foo;
    > string s;
    >
    > s = Console.ReadLine();
    > foo = IPAddress.Parse(s);
    >
    >
    > --
    >
    > *--------={ Fine Art for .NET }=--------*
    > | .Net Components @ www.abderaware.com |
    > *---------------------------------------*
    >
    > Turn on, tune in, download.
    > zane a@t abderaware.com


    --

    *--------={ Fine Art for .NET }=--------*
    | .Net Components @ www.abderaware.com |
    *---------------------------------------*

    Turn on, tune in, download.
    zane a@t abderaware.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center