Wrox Home  
 
Search P2P Archive for  go

More Wrox Resources

  Return to Index  

asp_web_howto thread: Re: how to Assign an object to a variable (Solution)


Message #1 by "Nilesh Parekh" <nilesh_parekh@d...> on Wed, 23 Jan 2002 09:53:44 +0530

This is a multi-part message in MIME format.



------=_NextPart_000_0017_01C1A3F3.D86654D0

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



Hi dee,



I have gone through your code and found the solution.

Try out this piece of code.



Sub main()

  Dim flsObj

  Call fsobject(flsObj)

  'now flsObj should be an object but isnt

  MsgBox flsObj.fileexists("c:\xyz.log") '(Some filename with path)

End Sub



Sub fsobject(ByRef flsObj)

 If IsObject(flsObj) =3D True Then Exit Sub

 'now i want to set the variable supplied to an object

 Set flsObj =3D CreateObject("scripting.filesystemobject")

 If Not flsObj Is Nothing Then

    MsgBox "Object created"

 End If

End Sub



cheers,

Nilesh





  ----- Original Message -----

  From: dee

  To: ASP Web HowTo

  Sent: Tuesday, January 22, 2002 4:07 PM

  Subject: [asp_web_howto] how to Assign an object to a variable





  I would like to know if it is possible to set a object to a variable 

with

  a function, using the variable name as the argument.

  I ussually do this by having a global variable name and then having a

  argumentless functioncall set the object to the global variable name. 

This

  works fine but it dosent seem the best way below is an example of how 

i

  would like to do it.

  but this dosent work thought.

  Is it possible if so how?????



  sub main()

    dim flsObj

    call fsobject(flsObj)

    'now flsObj should be an object but isnt

  end sub



  sub fsobject(byref flsObj)

   if isobject(flsObj) =3D true then exit function

   'now i want to set the variable supplied to an object

   set  flsObj =3D createobject("scripting.filesystemobject")

  end sub




$subst('Email.Unsub').







  Return to Index