1.

Difference Between Dim,public And Private Variables In Vb Script?

Answer»

Use of dim ,PRIVATE and public variables in VB script function first

dim a
a=20
msgbox a ‘ 20 DISPLAYS
end function
first
msgbox a ‘ this GIVES empty value
‘ so dim variables are not public if we use within function
dim b
b=30
function second
msgbox b ‘ 30 displays
end function
second
‘ if we DECLARE dim variables outside the function then it will act as public
class myclas
public c
private d
dim e
sub mysub
c=40
d=50
e=60
msgbox “public:“&c&” private :”&d&”dim :”&e
end sub
end class
set obj=new myclas
obj.mysub
msgbox obj.c
‘msgbox obj.d ‘it won’t allow to display private
variables
msgbox obj.e

Use of dim ,private and public variables in vb script function first



Discussion

No Comment Found