Results 1 to 4 of 4

Thread: Seperating a string

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    33

    Post

    Yes, im trying to seperate a string which just so happens to be a Ip. I want to be able to set some of the ip into a variable. Like lets say the ip is 123.32.21.12 How would u take out the 123.32.21. part and store it in a variable. Please Help

  2. #2
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    Try something like this: (IF you have VB6)

    Code:
    Private Sub Command1_Click()
    Dim ipParts() As String
    ipParts = Split("192.168.1.1", ".", -1, vbTextCompare)
    MsgBox "The First Part is: " & ipParts(0) & "." & ipParts(1) & "." & ipParts(2) & "."
    End Sub
    ------------------
    Tom Young, 14 Year Old
    [email protected]
    ICQ: 15743470 Add Me ICQ Me
    AIM: TomY10
    PERL, JavaScript and VB Programmer

    [This message has been edited by Compwiz (edited 11-28-1999).]

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    33

    Post

    That worx with the ip directly but is there a way to retrieve the ip from the textbx and then have it use it because when i trie to do that it doesnt wnat to work

  4. #4
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    Just change
    ipParts = Split("192.168.1.1", ".", -1, vbTextCompare)

    to
    ipParts = Split(Text1.Text, ".", -1, vbTextCompare)

    or whatever the textbox's name is.

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