|
-
Mar 18th, 2007, 07:21 AM
#1
Thread Starter
Frenzied Member
text file help
How do i write to a text file saying the word "Blocked" using a text box and a command button. I also would like to know how to delete from a text file thats on a server. The file that needs the word written to is
http://www.vbsoftware.biz/test.txt
Hope someone can help me.
Best Regards
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
-
Mar 18th, 2007, 07:57 AM
#2
Re: text file help
VB Code:
Option Explicit
Private Sub Command1_Click()
Dim iHandle As Long
iHandle = FreeFile()
Open "<Path to File>" For Output As iHandle
Print #iHandle, Text1.Text ' The text property says "Blocked"
Close iHandle
End Sub
If the file has been posted on the internet and it is not yours then you will not be able to ammend it, however if this is yours and you are ammending the text file through a web page then yould use the above as a script for a web page that ammends the file. If this is your text file on your server then you will need to open replace "<Path to File>" with the path of the file.
-
Mar 18th, 2007, 08:03 AM
#3
Thread Starter
Frenzied Member
Re: text file help
When i try that code
vb Code:
Private Sub Command1_Click()
Dim iHandle As Long
iHandle = FreeFile()
Open "http://www.vbsoftware.biz/disable/test.txt" For Output As iHandle
Print #iHandle, Text1.Text ' The text property says "Blocked"
Close iHandle
End Sub
It says Bad filename or Number then
highlights
vb Code:
Open "http://www.vbsoftware.biz/disable/test.txt" For Output As iHandle
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
-
Mar 18th, 2007, 10:49 AM
#4
Re: text file help
Of course it does, the open statement expects a directory, not a URL which is what you have provided. The Open statement searches your PC for the directory and file not, not the internet. That is why you get bad file mode because it can not find what you have specified.
You also need to take into account that the file you are looking to edit is stored on the internet. If this text file is stored on a server that you own then just use the directory where the file is stored on the server. If the server where this text file resides is 3rd Party (owned by someone else like phpBB) then you can't edit it.
Also, when i went on to the link you provided, the text file was being displayed as a web page.
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
|