Thursday, January 3, 2019



Difference between procedures and functions in vb script

Major difference between procedures and functions in vb script is that procedures can not return the value but functions can return the value.

Procedure Example -

Sub findsq()
   temp = InputBox("Please enter the number", 1)
   MsgBox "square root of the num is " & sqrt(temp)
End Sub


'Function Example
a = findsq()  ' function returns the value in variable a
msgbox a

function findsq()
 temp = InputBox("Please enter the number", 1)
findsq = sqrt(temp)
End function


Related Posts:

  • Dynamic Arrays in VBScript example Dynamic Arrays in VBScript example In Vb script we can define the dynamic array in vb script as mentioned below.Size of dynamic array changes at run time. Example -Dim a () - declared dynamic array aTo use dynami… Read More
  • How to shutdown a computer in VBScript? How to shutdown a computer in VBScript? 'Warning - if you run this script, your computer will shut down'Here you can specify name of the computer you want to  shut-down.....'. means local computerstrComputer = ".… Read More
  • How to read the environment variables in your system in vbscript? How to read the environment variables in your system in vbscript? You can read the system variables using below program        'Create the WMI object strComputer = "." Set objWMIService = GetObject… Read More
  • How to read webpage in vbscript How to read webpage in vbscript Here is an example in which I am using xmlhttp object to get the url source  code. We can get data from any website using below code. url="http://www.ebay.com" Set objHTTP = Crea… Read More
  • How to Restart a machine in vbscript? How to Restart a machine in vbscript? 'Warning - if you run this script, your computer will reboot/restart'Here you can specify name of computer you want to restart.....'. means local computerstrComputer = "."'create W… Read More

0 comments:

Post a Comment

Blog Archive

Translate

Popular Posts

Total Pageviews

152,033

Blog Archive