VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This simple function will return a Long number when provided with an Internet address. This is very

by Stephen Blaising (3 Submissions)
Category: Internet/HTML
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 13th December 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This simple function will return a Long number when provided with an Internet address. This is very useful if you use or plan to use the

Rate This simple function will return a Long number when provided with an Internet address. This is very



    
    Dim sFirst As String
    Dim sSecond As String
    Dim sThird As String
    Dim sForth As String
    Dim sAddress() As String
    
    'create an array by splitting the address by "."
    sAddress = Split(Trim(sIP), ".")
        
    'Get the hex of the number
    sFirst = Hex$(CLng(sAddress(0)))
    'make a 8-bit number by placing any 0's in front of the returned hex
    sFirst = String$(2 - Len(sFirst), "0") & sFirst
    'repeat
    sSecond = Hex$(CLng(sAddress(1)))
    sSecond = String$(2 - Len(sSecond), "0") & sSecond
    sThird = Hex$(CLng(sAddress(2)))
    sThird = String$(2 - Len(sThird), "0") & sThird
    sForth = Hex$(CLng(sAddress(3)))
    sForth = String$(2 - Len(sForth), "0") & sForth
    
    MakeLongOfInternetAddress = CLng("&H" & sFirst & sSecond & sThird & sForth)
   
End Function

Download this snippet    Add to My Saved Code

This simple function will return a Long number when provided with an Internet address. This is very Comments

No comments have been posted about This simple function will return a Long number when provided with an Internet address. This is very. Why not be the first to post a comment about This simple function will return a Long number when provided with an Internet address. This is very.

Post your comment

Subject:
Message:
0/1000 characters