|
-
Jun 28th, 2004, 02:21 PM
#1
Thread Starter
Lively Member
run-time error 54
VB Code:
Private Sub Form_Load()
Open "c:\TEXT.TXT" For Output As #1
Get #1, , fileinfo
Close #1
Text1.Text = fileinfo
End Sub
runtime error 54 "bad file mode". Highlights the 'get #1, , fileinfo" string of code
Any help would be appreciated
-
Jun 28th, 2004, 02:24 PM
#2
You have opened the file for output, which means that you intend to write to the file. The Get statement is used during file input.
But I'm not sure you can even use Get when opening for Input, I though it was only used for Random and Binary.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jun 28th, 2004, 02:27 PM
#3
Thread Starter
Lively Member
*edit* using random works. but now we're on a different problem:
error 458:
Variable uses an automation type not supported in Visual Basic
The text file contains:
"ASD"
Last edited by deranged; Jun 28th, 2004 at 02:31 PM.
-
Jun 28th, 2004, 03:37 PM
#4
Fanatic Member
Have you defined fileinfo as a variable...
-
Jun 28th, 2004, 04:55 PM
#5
Hyperactive Member
datatype
Please use a buffer while working with files but you have to Declare the type of that variable first, so
Code:
Private Sub Form_Load()
Dim strFileInfo
Open "c:\TEXT.TXT" For Input As #1
Get #1, , strFileInfo
Close #1
Text1.Text = strFileInfo
End Sub
By the way
You can also use relative path for file you wants to open.
Regards,
Vishalgiri Goswami
Gujarat, ( INDIA ).
---------------------
-
Jun 29th, 2004, 04:07 AM
#6
Thread Starter
Lively Member
that was also a solution. however i get another problem now.
error 59:
bad record length
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|