-
Oct 25th, 2008, 06:05 PM
#1
Thread Starter
Frenzied Member
How do I use the FileSystemObject in VB6 Professional?
I'm working in Visual Basic 6 Professional on Windows XP Home (I believe it's the "Home" version), and I found out that VB6 is supposed to have something called the FileSystemObject. I read it here:
http://articles.techrepublic.com.com...1-1050078.html
It says that you are supposed to invoke it with this code:
Code:
Dim fso As New FileSystemObject
But I can't get it to work. Can someone PLEASE help me with this.
-
Oct 25th, 2008, 06:14 PM
#2
Re: How do I use the FileSystemObject in VB6 Professional?
The FSO is part of Windows Scripting, not VB6. Of course you can use it within VB6 as easily as from VBScript.
You can't declare an object reference of that type until you set a reference to the library. This library is called Microsoft Scripting Runtime.
-
Oct 25th, 2008, 06:21 PM
#3
Thread Starter
Frenzied Member
Re: How do I use the FileSystemObject in VB6 Professional?
Originally Posted by dilettante
The FSO is part of Windows Scripting, not VB6. Of course you can use it within VB6 as easily as from VBScript.
You can't declare an object reference of that type until you set a reference to the library. This library is called Microsoft Scripting Runtime.
Is Microsoft Scripting Runtime something that comes with Windows XP Home? Or does it only come in the more expensive versions of XP? Or is it something I can just download anyway?
-
Oct 25th, 2008, 09:42 PM
#4
Re: How do I use the FileSystemObject in VB6 Professional?
I would think it comes with the Visual Studio installation since I can also use it in XP Home...
-
Oct 26th, 2008, 05:22 AM
#5
Re: How do I use the FileSystemObject in VB6 Professional?
You need to set a reference to it first.
Click on the: Projects>>References Menu
and locate 'Microsoft Scripting Runtime' from the list.
Then Declare:
Dim fso As FileSystemObject
Then in form_load you could have:
Set fso As New FileSystemObject
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
-
Oct 26th, 2008, 12:28 PM
#6
Fanatic Member
Re: How do I use the FileSystemObject in VB6 Professional?
Check my, BackupDisk, for , "Dim fso As FileSystemObject
example
Alpha Micro: Alpha Basic, AS400 V5r2, EDI (Trusted Link/ Inovis.com),Access AS/400 via VB6, Qbasic for data conversions. A mix of Hardware too. ASCII Table , New Number to Words/66 digits , AS/400(v5r2) VB6 Viewer/Ask for code(ODBC) ^ What Is Transferring? , Check your Ports #Perfect Passwords , *Slide Bar Example , Logoff, Restart, Shut-Down PC *Keep Form On Top , Opaque Form ^ Create Objects at Run Time @ Check Key Caps Locks # GetTickCount(System Up Time) * Convert text to Excel & Collected Icons + Resize: Form/Text box ^ PC GateWay via Shell $ Drag & Drop Game ! PopUpMenu *Print File/no Open# Timer on Mult Forms ~ Splash & Mult Forms & Lots of Comments + Random/Timer/Guess * Dec >Hex >Oct >Bin % Get MAC (NIC) < saving to Registry > Wookiee Cookies \ BackUpDisk / World Conection SpeedTest $ Glossary Commonly Used Terms # phonetic list @ Detailed Computer Scan
When posting Code, Use tags.. [CODE] *Your Code* [/CODE]
-
Oct 26th, 2008, 03:38 PM
#7
Thread Starter
Frenzied Member
Re: How do I use the FileSystemObject in VB6 Professional?
Originally Posted by some1uk03
You need to set a reference to it first.
Click on the: Projects>>References Menu
and locate 'Microsoft Scripting Runtime' from the list.
Then Declare:
Dim fso As FileSystemObject
Then in form_load you could have:
Set fso As New FileSystemObject
I saw somewhere someone used "Dim" and "As New" in the same line, like
Code:
Dim fso As New Filesystem Object
instead using the "Dim fso As" and "Set fso As New" in 2 separate lines. Why do you use the 2 separate lines?
-
Oct 26th, 2008, 04:42 PM
#8
Re: How do I use the FileSystemObject in VB6 Professional?
some1uk03 mixed it up, it is not
Code:
Set fso As New FileSystemObject
It should be
Code:
Set fso = New FileSystemObject
Have a look at this for instantiation explanations...
-
Oct 26th, 2008, 06:28 PM
#9
Thread Starter
Frenzied Member
Re: How do I use the FileSystemObject in VB6 Professional?
Originally Posted by dee-u
some1uk03 mixed it up, it is not
Code:
Set fso As New FileSystemObject
It should be
Code:
Set fso = New FileSystemObject
Have a look at this for instantiation explanations...
I still can't figure out how to get "Filesystemobject" to be the list of "New" things. So do I need to reinstall VisualStudio? When I installed it to start with, I just installed VB6 (no C++ or J or any of the other stuff.
And why use "Set" before making "fso" equal to something? I just set all of my variables with the equals sign by itself, like a=100.
I never say Set a=100.
-
Oct 26th, 2008, 06:32 PM
#10
Re: How do I use the FileSystemObject in VB6 Professional?
Have you installed SP6 already? If not then try installing it and check in it is already there...
-
Oct 26th, 2008, 06:49 PM
#11
Thread Starter
Frenzied Member
Re: How do I use the FileSystemObject in VB6 Professional?
Originally Posted by dee-u
Have you installed SP6 already? If not then try installing it and check in it is already there...
I thought that when I installed VB6 Professional it came with everything it should have.
When I look in the components manager (allows you to add controls to a project that aren't already on the toolbar), and I found one that says "Microsoft Windows Common Controls 6.0 (SP6)". So I assume that means I have SP6 on here.
Is the problem maybe that I'm running VB6 (not VB .Net) on a Windows XP computer? I heard that VB .Net was supposed to be just for Windows XP. But since a lot of the good commands were removed in the new Visual Basic, I'm sticking with VB6 Professional.
-
Oct 26th, 2008, 08:40 PM
#12
Junior Member
Re: How do I use the FileSystemObject in VB6 Professional?
Originally Posted by Ben321
I saw somewhere someone used "Dim" and "As New" in the same line, like
Code:
Dim fso As New Filesystem Object
instead using the "Dim fso As" and "Set fso As New" in 2 separate lines. Why do you use the 2 separate lines?
Both of 2 statements are mostly the same. But the Dim fso As New XXX is slow performance that compared to Dim FSO as XXXX : Set FSO= New XXXX
-
Oct 26th, 2008, 10:41 PM
#13
Re: How do I use the FileSystemObject in VB6 Professional?
Originally Posted by Ben321
I thought that when I installed VB6 Professional it came with everything it should have.
I am not exactly sure but just recently I have been fiddling with the VB6.0 installed in my home computer and it was lacking some controls like RichTextbox and others, I just installed SP6 and all of them was back again. I have not been able to use the VB6.0 installed in my computer for quite some time so I am not sure if those controls existed with my first install or maybe I have uninstalled them accidentally by other means...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|