Results 1 to 7 of 7

Thread: New and Exciting question

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    4

    Exclamation

    well not really i just couldn't think of a good title

    I have a command prompt and everything

    but one command is like
    /connect {IP address} and i want it to get the IP address
    and heres my problem... I am using a case statement so i am using this :

    Select Case message$
    Case "Close"
    End

    ------- Important Part ---------
    Case Left(Text3.Text, 8) = "/Connect"
    IP = Right(Text3.Text, (Len(Text3.Text)) - 9)
    Text2.Text = Text2.Text + "Connecting to IP: " + IP

    but that doesn't work...I don't know what is goin on PLEASE HELP!

  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    You might want to remove the line with End in it.

  3. #3
    Guest
    you have to use END SELECT to finish a select case block, not just END on its own.

    Does this help?

    PS, do not use the plus sign to concatenate strings, always use the "&" operator instead.

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    4
    I have all the important stuff guys (End Select all that) I just put the part of the code that wasn't working... the end hasn't done anything so i don't think its that. i am still in the dark

  5. #5
    Guest
    Select Case message$
    Case "Close"
    End

    ------- Important Part ---------
    BAD PART!!! --> Case Left(Text3.Text, 8) = "/Connect"
    IP = Right(Text3.Text, (Len(Text3.Text)) - 9)
    Text2.Text = Text2.Text + "Connecting to IP: " + IP

    Case Left(Text3.Text, 8) = "/Connect" is not a correct syntax. Case always follows the "Select Case" and cannot have a condition. You should change Case into If:

    Code:
    if message$ = "Close" then End 
    
    ------- Important Part --------- 
    If Left(Text3.Text, 8) = "/Connect" then
        IP = Right(Text3.Text, (Len(Text3.Text)) - 9) 
        Text2.Text = Text2.Text + "Connecting to IP: " + IP 
    end if

  6. #6
    Guest

    How come Yonatan never noticed that?

    Or is that what you mean?

    Do you really mean what I think you mean?

  7. #7
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    Listen to Escaflowne

    Escaflowne is correct and I think gives you the answer you are after. The End statement is perfectly valid where you have it, however you must think of Select Case very literally. All of Case .. clauses between the Select and End Select are only the Right hand side of the comparison.

    Code:
    Select Case x
    Case Is 1
    
    Case 1,2,3
    
    Case 1 To 5
    
    Case 1+2+3
    
    Case myFunction(1,2,3)
    
    Case Else
    
    End Select
    All of the above are valid examples (there are probably more as well)

    You will have to re-write your Select case or convert ot nested If..Then blocks.

    Regards
    Paul Lewis

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