Post Thread: Searching Database file if existing or not.

How to Add the Microsoft scripting runtime dll in my Project reference menu. I saw Microsoft Script in the components. Is this the file?

Anybody can help me or give me step by step procedure to add this Microsoft Scripting runtime dll in my project.

Thanks

Recommended Answers

All 2 Replies

scrrun.dll

That's the exact name of the dynamic link library (dll).

In that library of functions, the file system object can be referenced and used.

To add a reference to your project, simply click on the the Projects menu, click on the References Menu, and a form should show up listing the different libraries that are registered to be used with Visual Basic.

They are in alphabetical order. Look for Microsoft Scripting Runtime and check it's box, if it's not checked already. The Microsoft Script Control is a component used for writing scripts. It does not include the File System Object.

In the declarations section of your form you should declare your own File System Object. Declare an object variable

Option Explicit
dim MyFS0 as FileSystemObject
Dim strFileName as String

And then you should instantiate the object or make an instance of the object using the Set statement

Private Sub Form_Load()
  Set MyFSO = New FileSystemObject
  ' You can now use it.
  if MyFSO.FileExists(strFileName) then
    '  Code if it exists 
  else
    ' Code if it doesn't exist
  endif


'  Be careful to reclaim your variable space in memory after done using the object
Set MyFSO = nothing
End Sub

More in depth information should be gleaned from the MSDN Library: What Can You Do With Visual Basic: Processing Drives, Folders, and Files

Awesome!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.