Posts

Showing posts from August, 2016

VB Script - Simple Calculator Using Procedure Call

Steps to Run: 1] Open Notepad.exe or Notepad++.exe 2] Copy below VB script source code into notepad 3] Save File as "Calculate.vbs" 4] Run file and enter values 'Simple Calculator which take input of two values and pass operator sign (like +, -, *, /) ' Variable Declaration Dim val1,val2,optval,results ' Get Inputbox values into declared variable val1 = CInt(InputBox("Enter First Number Here: ","Title: Enter First Value")) val2 = CInt(InputBox("Enter Second Number Here: ","Title: Enter Second Value"))  optval = InputBox("Enter Operator Value e.g. + , * , / , - : ","Title: Enter Operator Value")  ' Call to Procedure name <MathCalc>, Pass option value to procedure  MathCalc(optval) ' Private procedure call starts Private Sub MathCalc(optval) 'Use select case option to select the operator values Select Case optval Case "+" results = (val1) + (val2) Case "-" ...

VB Script - Simple Calculator

Steps to Run: 1] Open Notepad.exe or Notepad++.exe 2] Copy below VB script source code into notepad 3] Save File as "Calculate.vbs" 4] Run file and enter values 'Simple Calculator which take input of two values and pass operator sign (like +, -, *, /) Dim val1,val2,optval,results val1 = InputBox("Enter First Number Here: ","Title: Enter First Value")  val2 = InputBox("Enter Second Number Here: ","Title: Enter Second Value")  optval = InputBox("Enter Operator Value e.g. + , * , / , - : ","Title: Enter Operator Value")  Select Case optval Case "+" results = CInt(val1) + CInt(val2) Case "-" results = CInt(val1) - CInt(val2) Case "/" results = CInt(val1) / CInt(val2) Case "*" results = CInt(val1) * CInt(val2) End Select MsgBox ("Your Results is : " & val1 & optval & val2 & " = " & results) Short Summary(Learned so ...