|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
VB6 - Unable to read Text FileFor whatever reason I am unable to use FileSystemObject
e.g. using the code: Dim fso As New FileSystemObject Everytime my program hits this it gives the error: "Compile error: User-defined type not defined" Am I missing something? "Rob Leyshon" <r**@snoogans.plus.com> wrote in message Yes, but I'm not even going to tell you what, because the FSOnews:425e88c3$0$570$ed2619ec@ptn-nntp-reader03.plus.net... > For whatever reason I am unable to use FileSystemObject > Dim fso As New FileSystemObject > "Compile error: User-defined type not defined" > > Am I missing something? just /isn't/ worth the overhead or hassle just to read a text file. Use VB's built-in file handling methods, as in Dim iFile as Integer iFile = FreeFile() Open "file" for Input as #iFile Dim sData as String sData = Input$( LOF( iFile), #iFile ) Close #iFile ' sData now contains the entire file for you to play with, or iFile = FreeFile() Open "file" for Input as #iFile Do While Not EOF( iFile ) Line Input sData, #iFile ' 1 line at a time Loop Close #iFile HTH, Phill W. sorry Herrfried :-( ( i know it is the wrong place )
but i can`t agree on this > because the FSO FSO is superior in speed> just /isn't/ worth the overhead or hassle just to read a text file. if you indeed need to read / write a file one time okay i would agree with the overhead responce however if you do multiple file operations ( for instance generating html for the webbrowser control ) you sure see a hughe performance boost if you use the filesystem object also generating unicode files can only be done with FSO ( needed to write a Russian site generator for the webbrowser control in the past ) just my 2 dollar cents ( as they are less worth :- ) Show quoteHide quote "Phill. W" <P.A.Ward@o-p-e-n-.-a-c-.-u-k> wrote in message news:d3m1lg$kbb$1@yarrow.open.ac.uk... > "Rob Leyshon" <r**@snoogans.plus.com> wrote in message > news:425e88c3$0$570$ed2619ec@ptn-nntp-reader03.plus.net... > > For whatever reason I am unable to use FileSystemObject > > Dim fso As New FileSystemObject > > "Compile error: User-defined type not defined" > > > > Am I missing something? > > Yes, but I'm not even going to tell you what, because the FSO > just /isn't/ worth the overhead or hassle just to read a text file. > Use VB's built-in file handling methods, as in > > Dim iFile as Integer > iFile = FreeFile() > Open "file" for Input as #iFile > Dim sData as String > sData = Input$( LOF( iFile), #iFile ) > Close #iFile > > ' sData now contains the entire file for you to play with, or > > iFile = FreeFile() > Open "file" for Input as #iFile > Do While Not EOF( iFile ) > Line Input sData, #iFile ' 1 line at a time > Loop > Close #iFile > > HTH, > Phill W. > > "M. Posseth" <mich***@nohausystems.nl> schrieb: No problem...> sorry Herrfried :-( ( i know it is the wrong place ) > but i can`t agree on this The problem with the FSO is that some admins block the FSO for security > >> because the FSO >> just /isn't/ worth the overhead or hassle just to read a text file. > > > FSO is superior in speed reasons and thus applications which rely on the FSO cannot be used in every corporate environment. However, I agree with you that the FSO is superior to VB's intrinsic file access functions in some aspects. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> "Rob Leyshon" <r**@snoogans.plus.com> schrieb: You are missing a reference to "Microsoft Scripting Runtime".> For whatever reason I am unable to use FileSystemObject > > e.g. using the code: > Dim fso As New FileSystemObject > > Everytime my program hits this it gives the error: > "Compile error: User-defined type not defined" > > Am I missing something? BTW: This group is dedicated to Visual Basic .NET, for VB6-related questions consider posting to one of the groups in the microsoft.public.vb.* hierarchy. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Why use Events?
ownerdraw menu, help appreciated [Datable] change column datatype Custom collections Best way to get the value of one particular node of an XML string Crystal Report Database Change Update Command with Parameter.... Application class problem Create common functions library Stupid DLL's! |
|||||||||||||||||||||||