Results 1 to 3 of 3

Thread: Seperating two parts of the proxy

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    154
    This could probably be posted in the regular vb forum, but it deals with proxies.. so what the hey.

    I have my proxy loaded into a text box like this:
    34.343.343.23:80
    All i need to know is how to split up the two parts to put into seperate text boxes.

    For example:
    text1.text would have: 34.343.343.23:80
    therefore proxy.text would have 34.343.343.23
    and port.text would have: 80


    thanks for the help guys

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Location
    Gloucester, UK
    Posts
    78
    INSTR allows you to find a specific character within a string and returns the character's position.

    So something like:

    Dim lngColonPos as long


    lngColonPos = instr(1,text1.text,":",vbtextcompare)

    'This should return the server IP
    proxy.text = left$(text1.text, lngcolonpos -1)

    'This should return just the port
    port.text = mid$(text1.text, lngcolonpos +1)

    --------------------------------------------------------------

    Outta do it .... you may need to do checks of course, ie that the user actually did use a colon to separate the port etc...

    Hope this helps - if not - heh, sorry I must of mis-understood the question...

  3. #3
    Lively Member harsoni's Avatar
    Join Date
    Oct 2000
    Posts
    118
    Use the Split function in VBSCRIPT


    Ex:

    Dim str
    str = Split("34.343.343.23:80", ":", -1, 1)
    proxy.text = str(0)
    port.text = str(1)

    Hope this helps

    Sonia

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