Reapz Posted December 15, 2002 Posted December 15, 2002 Firstly, if this topic has already been discussed I apologise for repeating a thread but whenever I search for 'FileSystemObject' it says theres a load of results but I can't actually see any of 'em. Anyway, I've been writing an application in VB6 and a friend lent me his copy of VS.NET to check out and I been trying to write the same project in that (bear in mind I'm a bit of a noob). I was using FileSystemObject to read and write to text files and get Dir and Folder info etc and I had it working perfectly. The problem I'm have now is that VB.NET won't let me use the FSO. I have referenced Microsoft Scripting Runtime and checked that it does indeed appear in the references but still no dice. I have tried both Dim fso As New FileSystemObject (in this case FileSystemObject doesn't even appear in the list) and fso = CreateObject("Scripting.FileSystemObject") but it just won't work. Any help would be greatly appreciated as I can't proceed any further with my App until I get this working. Cheers! Quote I'm getting the hang of this now... No really I am!
*Experts* Volte Posted December 15, 2002 *Experts* Posted December 15, 2002 Don't use the FSO in .NET. There is a System.IO namespace which contains all kinds of file access functions. Search your MSDN, as well as EliteVB for documentation on how to use it. Quote
Reapz Posted December 15, 2002 Author Posted December 15, 2002 Further inspection of the documentation has revealed the existence of the System.IO model. Does this mean the FileSystemObject is redundant? That would explain why it doesn't work. :D Why then do the help files infer that it is still an available option? System.IO seems simple enough but I would like to avoid having to changing all my code! :( Ah well... Quote I'm getting the hang of this now... No really I am!
Reapz Posted December 15, 2002 Author Posted December 15, 2002 LOL! Cheers VolteFace as you may have guessed I just noticed it! Thanks m8! :) Quote I'm getting the hang of this now... No really I am!
*Experts* Volte Posted December 15, 2002 *Experts* Posted December 15, 2002 In response to your "why then do the help files infer that it is still an available option" question: Well, the FileSystemObject does still exist in Windows, and therefore, with some coaxing, it's probably usable in .NET. It's not recommended, (even in VB6 it wasn't recommended; it's mostly for VBScript), but it's possible. The help files probably show some documentation for it for backwards compatibility purposes, though I find most of Microsoft's compatibility stuff useless. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.