Results 1 to 5 of 5

Thread: Old string functions [Resolved]

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    262

    Resolved Old string functions [Resolved]

    Hi,
    have just been looking at a bit of code submitted by Gigemboy to redivert the results from a cmd prompt. I want to use this to check to see if a server is running by pinging it and seeing how many packets were returned.
    Anyway am waffaling a bit, my main questions is how to make this more .net like, eg not using mid and instr.
    Had a quick look at the string class but can't see any equivalants (sure I'm just missing them though)

    VB Code:
    1. Private Function succesfulping(ByVal cmdp As String) As Boolean
    2.         Dim recp As Integer
    3.         Dim pacr As Integer
    4.         recp = InStr(cmdp, "Received") + 11
    5.         Try
    6.             pacr = CInt(Mid(cmdp, recp, 1))
    7.         Catch
    8.             pacr = 0
    9.         End Try
    10.  
    11.         Select Case pacr
    12.  
    13.             Case 0
    14.                 succesfulping = False
    15.             Case 1
    16.                 succesfulping = False
    17.             Case 2
    18.                 succesfulping = False
    19.             Case 4
    20.                 succesfulping = True
    21.             Case Else
    22.                 succesfulping = False
    23.         End Select
    24.  
    25.     End Function
    Last edited by Oliver1; Mar 20th, 2006 at 11:44 AM. Reason: Resolved

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