For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > April 2005 > compile error in vb6









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author compile error in vb6
inquirer

2005-04-28, 8:55 am

When I try to run this statement copied from the VB help

Dim fso As New FileSystemObject, txtfile, fil1, fil2

I get a Compile error: User-defined type not defined.

Could someone tell me what is wrong please?
Thanks
Chris


J French

2005-04-28, 8:55 am

On Thu, 28 Apr 2005 16:27:16 +1000, "inquirer" <noreply@noreply.com>
wrote:

>When I try to run this statement copied from the VB help
>
>Dim fso As New FileSystemObject, txtfile, fil1, fil2
>
>I get a Compile error: User-defined type not defined.
>
>Could someone tell me what is wrong please?


Looks like you do not have a reference to the Scripting stuff

If you want to do file stuff, you would be far better of using the
native VB file handling commands

The FSO stinks


inquirer

2005-04-28, 8:55 am

Thanks, could you tell me which reference to set or the easiest way to
delete a file in vb.
I have tried
shell "del " & fname
where fname is something like "f:\temp dir\myfile.txt"
but keep getting file not found errors

Chris
"J French" <erewhon@nowhere.uk> wrote in message
news:42708f2c.260257670@news.btclick.com...
> On Thu, 28 Apr 2005 16:27:16 +1000, "inquirer" <noreply@noreply.com>
> wrote:
>
>
> Looks like you do not have a reference to the Scripting stuff
>
> If you want to do file stuff, you would be far better of using the
> native VB file handling commands
>
> The FSO stinks
>
>



J French

2005-04-28, 8:55 am

On Thu, 28 Apr 2005 17:38:10 +1000, "inquirer" <noreply@noreply.com>
wrote:

>Thanks, could you tell me which reference to set or the easiest way to
>delete a file in vb.
>I have tried
>shell "del " & fname
>where fname is something like "f:\temp dir\myfile.txt"
>but keep getting file not found errors


Kill "f:\temp dir\myfile.txt"


Michael Cole

2005-04-28, 8:55 am

inquirer wrote:
> Thanks, could you tell me which reference to set or the easiest way to
> delete a file in vb.
> I have tried
> shell "del " & fname
> where fname is something like "f:\temp dir\myfile.txt"
> but keep getting file not found errors


Look up "Kill" in the help file. Why do things the hard way...

--
Regards,

Michael Cole


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com