View Single Post
  #1 (permalink)  
Old December 4th, 2004, 03:37 AM
dawngeorge dawngeorge is offline
Registered User
 
Join Date: Dec 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem in opening file

i am using an embedded vb application to open and display the contents of a file in a test box....


Dim fso As FileCtl.FileSystem
Dim Fil As FileCtl.File
Dim StrFullFileName As String
Dim sTheData As String

StrFullFileName = "\Program Files\text.txt"

Set fso = CreateObject("FileCtl.FileSystem")
Set Fil = CreateObject("FileCtl.File")

If Len(fso.Dir(StrFullFileName)) > 0 Then
Fil.Open StrFullFileName, fsModeInput, fsAccessRead
sTheData = Fil.LineInputString
 Text1.Text = sTheData
Else
MsgBox StrFullFileName & " does not exist."
End If

Set fso = Nothing
Set Fil = Nothing

but each time i run the program i am getting an error saying that the file do not exist ..this is my file location c:\Program Files\text.txt .Even if i give the full path i am getting the same error.....
please give a solution for this problem

thanks in advance

Reply With Quote