By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,882 Members | 2,082 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,882 IT Pros & Developers. It's quick & easy.

Vb Code Meaning

P: 45
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...

Expand|Select|Wrap|Line Numbers
  1. '==================================================
  2.     ' Purpose : - Executes the perl file "createbatchfile.pl"
  3.                  'This file in turn creates generaterpt.bat which generates the reports
  4. '=================================================='
  5. Public Function CreateScriptFile() As Boolean
  6. On Error GoTo ErrorLine
  7.     Dim intPages As Integer
  8.     Dim strPages As String
  9.     Dim strOutputPath As String
  10.  
  11.     CreateScriptFile = True
  12.     If FrmTestProfile.chkFilter.Value = 1 Then
  13.        gstrInputFile = "SteadyState_" & gstrInputFile
  14.     End If
  15.     gstrScriptDir = App.Path & "\scripts"
  16.     drive = Mid(gstrScriptDir, 1, 2)
  17.     ChDrive (drive)
  18.     ChDir (gstrScriptDir)
  19.     strOutputPath = FrmTestProfile.TxtOutputPath.Text
  20.     If FrmTestProfile.ChkTimer.Value <> 0 Then
  21.         Dim inputtimerfile As String
  22.         Dim outputtimerfile As String
  23.         Dim str As String
  24.             inputtimerfile = Mid(FrmTestProfile.TxtInputTimerFile.Text, InStrRev(FrmTestProfile.TxtInputTimerFile.Text, "\") + 1)
  25.             outputtimerfile = Mid(inputtimerfile, 1, InStrRev(inputtimerfile, ".") - 1)
  26.         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)
  27.     Else
  28.         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)
  29.     End If
  30.     Exit Function
  31. ErrorLine:
  32.     MsgBox "Error-Number:" & Err.Number & vbCrLf & "Error Description:" & Err.DESCRIPTION & vbCrLf & "Error At: Calling  createbatchfile.pl"
  33. End Function
in this code am not able to understand the shellandwaitfortermination code
in that what does chr(34) stands for...


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


thanks in advance

sairaam
Apr 13 '07 #1
Share this Question
Share on Google+
2 Replies


iburyak
Expert 100+
P: 1,017
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 :


Expand|Select|Wrap|Line Numbers
  1. Dim Name as string
  2.  
  3. Name = "SAIRAAM"
  4.  
  5. MsgBox "Hello " & Chr(34) & Name & Chr(34) & "!"
Result will be:

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


Hope it helps.
Apr 13 '07 #2

P: 45
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 :


Expand|Select|Wrap|Line Numbers
  1. Dim Name as string
  2.  
  3. Name = "SAIRAAM"
  4.  
  5. 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
Apr 16 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.