File1.Open newbie problem 
Author Message
 File1.Open newbie problem

I'm not sure why the following routine does not work. I get the error
"variable not defined: File1"

Private Sub submit_Click()
 File1.Open "Test.txt", fsAppendMode
 File1.LinePrint "Hello world"
 File1.Close
End Sub

Am I missing some declarations or other initiating code ?

Thanks



Tue, 09 Dec 2003 05:27:33 GMT  
 File1.Open newbie problem
Did you place the file control on your form?
You can also create the file control programmatically:
Dim File1
File1 = CreateObject("FILECTL.File")

Also you need to define fsAppendMode

Place this in a module:
' --------------------------------------------------------------------------
---
' File/FileSystem Control
' --------------------------------------------------------------------------
---

' File Mode
Const fsModeInput = 1
Const fsModeOutput = 2
Const fsModeRandom = 4
Const fsModeAppend = 8
Const fsModeBinary = 32

' File Access Type
Const fsAccessRead = 1
Const fsAccessWrite = 2
Const fsAccessReadWrite = 3

' File Lock Mode
Const fsLockReadWrite = 0
Const fsLockWrite = 1
Const fsLockRead = 2
Const fsLockShared = 3

' File Attributes
Const fsAttrNormal = 0
Const fsAttrReadOnly = 1
Const fsAttrHidden = 2
Const fsAttrSystem = 4
Const fsAttrVolume = 8
Const fsAttrDirectory = 16
Const fsAttrArchive = 32

Brian Crosby

Quote:

> I'm not sure why the following routine does not work. I get the error
> "variable not defined: File1"

> Private Sub submit_Click()
>  File1.Open "Test.txt", fsAppendMode
>  File1.LinePrint "Hello world"
>  File1.Close
> End Sub

> Am I missing some declarations or other initiating code ?

> Thanks



Tue, 09 Dec 2003 06:02:18 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Why do I get a File1.open error

2. file1.open does not work

3. Stupid "Name file1 As file2" problem

4. File1.Filename Problem HELP!!!

5. Newbie problems using varibales in open statement

6. Passing values selected from Dir1 & File1

7. File1 Help!

8. file1.list(i)...wierd return

9. file1.list(i)=...

10. Passing File1.filename as argument

11. file1.list(i)=...

12. VB Dir1 and File1

 

 
Powered by phpBB® Forum Software