Vb Code Meaning

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SAIRAAM
    New Member
    • Feb 2007
    • 45

    Vb Code Meaning

    hi everyone..... i am working on a performance testing tool for which i had been given a sample code of the existing tool for which the user interface is designed in vb... perl plugin programs are used to do appropriate functions... noe here i am not able to understand the portion of the code..... can anyone help in doing it... i am here with attached the code also...

    Code:
    '==================================================
        ' Purpose : - Executes the perl file "createbatchfile.pl"
                     'This file in turn creates generaterpt.bat which generates the reports
    '=================================================='
    Public Function CreateScriptFile() As Boolean
    On Error GoTo ErrorLine
        Dim intPages As Integer
        Dim strPages As String
        Dim strOutputPath As String
        
        CreateScriptFile = True
        If FrmTestProfile.chkFilter.Value = 1 Then
           gstrInputFile = "SteadyState_" & gstrInputFile
        End If
        gstrScriptDir = App.Path & "\scripts"
        drive = Mid(gstrScriptDir, 1, 2)
        ChDrive (drive)
        ChDir (gstrScriptDir)
        strOutputPath = FrmTestProfile.TxtOutputPath.Text
        If FrmTestProfile.ChkTimer.Value <> 0 Then
            Dim inputtimerfile As String
            Dim outputtimerfile As String
            Dim str As String
                inputtimerfile = Mid(FrmTestProfile.TxtInputTimerFile.Text, InStrRev(FrmTestProfile.TxtInputTimerFile.Text, "\") + 1)
                outputtimerfile = Mid(inputtimerfile, 1, InStrRev(inputtimerfile, ".") - 1)
            ShellAndWaitForTermination "perl createbatchfile.pl " & gstrInputFile & " " & Chr(34) & Replace(strOutputPath, "\", "/") & Chr(34) & " " & Chr(34) & Replace(InputPath, "\", "/") & Chr(34) & " " & Val(FrmTestProfile.ChkPage) & " " & Val(FrmTestProfile.TxtPages.Text) & " " & Chr(34) & Replace(App.Path & "/scripts", "\", "/") & Chr(34) & " " & Chr(34) & Replace(App.Path & "/wgnuplot3.7/wgnuplot.exe", "\", "/") & Chr(34) & " " & Chr(34) & inputtimerfile & Chr(34) & " " & Chr(34) & FrmTestProfile.lblTestId.Caption & Chr(34) & " " & Chr(34) & outputtimerfile & ".html" & Chr(34)
        Else
            ShellAndWaitForTermination "perl createbatchfile.pl " & gstrInputFile & " " & Chr(34) & Replace(strOutputPath, "\", "/") & Chr(34) & " " & Chr(34) & Replace(InputPath, "\", "/") & Chr(34) & " " & Val(FrmTestProfile.ChkPage) & " " & Val(FrmTestProfile.TxtPages.Text) & " " & Chr(34) & Replace(App.Path & "/scripts", "\", "/") & Chr(34) & " " & Chr(34) & Replace(App.Path & "/wgnuplot3.7/wgnuplot.exe", "\", "/") & Chr(34) & " " & Chr(34) & inputtimerfile & Chr(34) & " " & Chr(34) & FrmTestProfile.lblTestId.Caption & Chr(34)
        End If
        Exit Function
    ErrorLine:
        MsgBox "Error-Number:" & Err.Number & vbCrLf & "Error Description:" & Err.DESCRIPTION & vbCrLf & "Error At: Calling  createbatchfile.pl"
    End Function
    in this code am not able to understand the shellandwaitfor termination code
    in that what does chr(34) stands for...


    i would be greatful to whatever help i get...


    thanks in advance

    sairaam
  • iburyak
    Recognized Expert Top Contributor
    • Nov 2006
    • 1016

    #2
    Chr(34) is a double quote.

    Because VB has it's own quotes some programmers just put Chr(34) not to mix it with a language requirements so the result string will have a quote and it will not be misunderstood for anything else.

    If I want to have result sentence like below in VB and your name is a variable I will do following :


    Code:
    Dim Name as string
    
    Name = "SAIRAAM"
    
    MsgBox "Hello " & Chr(34) & Name & Chr(34) & "!"
    Result will be:

    [PHP]Hello "SAIRAAM"![/PHP]


    Hope it helps.
    Last edited by Killer42; Apr 13 '07, 07:06 AM. Reason: Tidied up the quotes

    Comment

    • SAIRAAM
      New Member
      • Feb 2007
      • 45

      #3
      Originally posted by iburyak
      Chr(34) is a double quote.

      Because VB has it's own quotes some programmers just put Chr(34) not to mix it with a language requirements so the result string will have a quote and it will not be misunderstood for anything else.

      If I want to have result sentence like below in VB and your name is a variable I will do following :


      Code:
      Dim Name as string
      
      Name = "SAIRAAM"
      
      MsgBox "Hello " & Chr(34) & Name & Chr(34) & "!"
      Result will be:

      [PHP]Hello "SAIRAAM"![/PHP]


      Hope it helps.
      thanks sir very much for ur guidence..... am able to understand now...will come back if i have some more queries


      thanks
      sairaam

      Comment

      Working...