The MP3car.com Store  

Welcome to the MP3Car.com forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. Registering will also remove advertisements. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development > Coders Corner

Reply
 
Thread Tools Display Modes
Old 12-12-2007, 08:36 PM   #1
inh
Maximum Bitrate
 
Join Date: Jan 2007
Location: Fort Riley KS
Vehicle: 91 CRX Si
Posts: 514
My Photos: (0)
VB6 FileSystemObject woes

Im trying to get VB6 to delete a file, using the FileSystemObject, but I cant get it created..

I am trying to define it using this in the on form load event:

Dim fso As New FileSystemObject

I get a 'user defined type not defined' error.. Any ideas guys? =/
__________________
Space Navigator - 6 Axis input device: Take it apart - Driver App
RRCam - Video/webcam capture, text overlay, and recording: 2.0 Stable
inh is offline   Reply With Quote
Sponsored Links
Old 12-12-2007, 08:52 PM   #2
Confusion Master
Enforcer's CarPC Specs
 
Enforcer's Avatar
 
Join Date: Sep 2003
Location: If you go down to the woods today, You're sure of
Vehicle: 1997 BMW E36 328I
Posts: 9,726
My Photos: (1)
1. have you set up a reference in Project->References to the Microsoft Scripting Runtime?

2. Have you got scrrun.dll on your PC?
Enforcer is offline   Reply With Quote
Old 12-12-2007, 09:07 PM   #3
inh
Maximum Bitrate
 
Join Date: Jan 2007
Location: Fort Riley KS
Vehicle: 91 CRX Si
Posts: 514
My Photos: (0)
Quote: Originally Posted by Enforcer View Post
1. have you set up a reference in Project->References to the Microsoft Scripting Runtime?

2. Have you got scrrun.dll on your PC?

I setup the reference, no more error =] Thank you!

Will i have to distribute scrrun.dll with my program? Or is this a standard windows component?
__________________
Space Navigator - 6 Axis input device: Take it apart - Driver App
RRCam - Video/webcam capture, text overlay, and recording: 2.0 Stable
inh is offline   Reply With Quote
Old 12-12-2007, 09:43 PM   #4
Confusion Master
Enforcer's CarPC Specs
 
Enforcer's Avatar
 
Join Date: Sep 2003
Location: If you go down to the woods today, You're sure of
Vehicle: 1997 BMW E36 328I
Posts: 9,726
My Photos: (1)
It should be standard however there are different versions so distributing it will not be a good idea.
Enforcer is offline   Reply With Quote
Old 12-15-2007, 08:21 AM   #5
Newbie
ClockWorK's CarPC Specs
 
ClockWorK's Avatar
 
Join Date: Oct 2003
Location: Michigan
Vehicle: 2004 Pontiac Grand Prix GTP CompG
Posts: 25
My Photos: (79)
Other options

Personally, I prefer using the win32 API over system objects. Try the DeleteFile API or even the Kill command. If you use KILL, wrap it with an error trap. If you use the API, the return value is non-zero for successful delete. Make sure to add the API declaration to one of your modules though.

'in the declares of a module:
Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long

'Then call it like:
dim retVal as long
retVal = DeleteFile(fullFileName)
'then check retVal.

or use the Kill command:
on error resume next
Kill fullFileName
on error goto 0
'then check error state or check if file still exists

My 2 cents. Hope it helps.
ClockWorK is offline   Reply With Quote
Old 12-15-2007, 08:28 AM   #6
inh
Maximum Bitrate
 
Join Date: Jan 2007
Location: Fort Riley KS
Vehicle: 91 CRX Si
Posts: 514
My Photos: (0)
Much appreciated =] I'll probably just leave the system object in though, since ive already tested it and it works fine. There is really no reason it should be passed invalid info, since it is only deleting files that the program has created =]
__________________
Space Navigator - 6 Axis input device: Take it apart - Driver App
RRCam - Video/webcam capture, text overlay, and recording: 2.0 Stable
inh is offline   Reply With Quote
Old 02-05-2008, 05:08 AM   #7
Newbie
st1mpy's CarPC Specs
 
Join Date: Aug 2007
Posts: 16
My Photos: (0)
Quote: Originally Posted by inh View Post
Im trying to get VB6 to delete a file, using the FileSystemObject, but I cant get it created..

I am trying to define it using this in the on form load event:

Dim fso As New FileSystemObject

I get a 'user defined type not defined' error.. Any ideas guys? =/

Try Dim fso
set fso = createobject("scripting.filesystemobject")
st1mpy is offline   Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Questions about Destinator 3 SDK and VB6 gsova Coders Corner 4 01-17-2007 06:36 AM
VB6 vs VB 2005 Express alimh Road Runner 4 11-14-2006 05:36 AM
VB6: Does anyone have experience with adding moudlarity to their apps? Mrbmw99 Coders Corner 2 10-15-2006 06:19 PM
SDK - VB6 App Gobby RR Bug Tracker 2 05-08-2005 04:58 AM
Screwy docked toolbox in VB6!! deadweasel Software & Software Development 5 02-12-2004 02:06 AM


All times are GMT -5. The time now is 01:55 AM.


Sponsored Links
The MP3car.com Store

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Copyright © 1999 - 2008 Mp3Car.com Inc.
Ad Management by RedTyger
Message Board Statistics