Results 1 to 5 of 5

Thread: IP Adress in Textbox

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    51

    Question

    How ca i codec a Textbox that only a "valied IP Adress" can be insert? only numbers 0 and <256.

  2. #2
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Split the IP address up into its 4 numbers, using the InStr() and Mid() functions, and then check that each is between 0 - 255. You can use the Val() function to convert a string to a number.
    Harry.

    "From one thing, know ten thousand things."

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    51

    Exclamation Ip Adress

    Ca u give me an example? im really a beginner :-))

    thx a lot

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    51

    Unhappy HELP!!!

    i need a code for this.....can anybody help me?????

  5. #5
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    I doing just that in one of my apps.

    To break out the address bytes:

    Code:
    Dim sIP    As String
    Dim cntl   As Integer
       
    ' extract the IP address byte values from gsHost
    sIP = gsRHost
    cntl = InStr(sIP, ".")
    txtIPAddr1.Text = Left$(sIP, cntl - 1)
    sIP = Mid$(sIP, cntl + 1)
    cntl = InStr(sIP, ".")
    txtIPAddr2.Text = Left$(sIP, cntl - 1)
    sIP = Mid$(sIP, cntl + 1)
    cntl = InStr(sIP, ".")
    txtIPAddr3.Text = Left$(sIP, cntl - 1)
    sIP = Mid$(sIP, cntl + 1)
    txtIPAddr4.Text = sIP
    And to put it all back together:

    Code:
    gsRHost = txtIPAddr1.Text & "." & _
              txtIPAddr2.Text & "." & _
              txtIPAddr3.Text & "." & _
              txtIPAddr4.Text

Posting Permissions

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



Click Here to Expand Forum to Full Width