Decimal IP string to Dotted Decimal IP string Conu

Results 1 to 3 of 3

Thread: Decimal IP string to Dotted Decimal IP string Conu

  1. #1
    Join Date
    Dec 1969

    Default Decimal IP string to Dotted Decimal IP string Conu

    Hello, <BR><BR>I have a need to convert a decimal IP to dotted decimal notation. I have tried to do this with VB functions (converting the number to a binary string, separating octets and working from there) and even tried to do it with a VB component but both options choke because VB apparently can&#039;t handle numbers bigger than 31 bits. Is there any way around this? Just for the record, we&#039;re getting the decimal IP from a NetMeeting AD ILS object. It doesn&#039;t seem to be able to output to a dotted decimal format, only decimal (and backwards, at that).<BR><BR>Thanks for any help on this subject,<BR>Darren

  2. #2
    Join Date
    Dec 1969

    Default Convert it to a wide string

    or whatever, instead of using a "binary" string.

  3. #3
    Join Date
    Dec 1969

    Default How will that help???

    If the dotted ip address would have a number greater than 127 in the first place, then the string-ized version of the number will be negative.<BR><BR>But VBS has built-in help for this! The HEX function will get us a string we *can* work with.<BR><BR>Let&#039;s see...<BR><BR>Function ipstr( ipnum )<BR>&nbsp; &nbsp; Dim temp<BR>&nbsp; &nbsp; temp = Right( "00000000" & Hex(CLNG(ipnum)), 8 )<BR>&nbsp; &nbsp; Dim iparr(3)<BR>&nbsp; &nbsp; For i = 1 to 4<BR>&nbsp; &nbsp; &nbsp; &nbsp; iparr(i-1) = Cint( "&H" & Mid(temp,i*2-1,2) )<BR>&nbsp; &nbsp; Next<BR>&nbsp; &nbsp; ipstr = Join( iparr, "." )<BR>End Function<BR><BR>See if that works...<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts