| View previous topic :: View next topic |
| Author |
Message |
OSIRIS Grandmaster Cheater
Reputation: 0
Joined: 27 Aug 2006 Posts: 654
|
Posted: Tue Mar 11, 2008 8:22 am Post subject: writting text. |
|
|
| Code: | Dim FILE_NAME As String = "C:\test5.txt"
Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
objWriter.Write("TEXT FOR FILE GOES HERE")
objWriter.Close()
MsgBox("Text written to file") |
Thats the code im trying to use to write the text. But I always get an acess denied error.
Last edited by OSIRIS on Tue Mar 11, 2008 8:35 am; edited 1 time in total |
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Tue Mar 11, 2008 8:24 am Post subject: |
|
|
| make sure the file isn't in use or a system file.
|
|
| Back to top |
|
 |
OSIRIS Grandmaster Cheater
Reputation: 0
Joined: 27 Aug 2006 Posts: 654
|
Posted: Tue Mar 11, 2008 8:27 am Post subject: |
|
|
| I give the user a choice of where to save the file his option is stored in a variable called location. And Im trying to create the file so it couldnt be in use already
|
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Tue Mar 11, 2008 8:30 am Post subject: |
|
|
lemme see
(i probably can't solve but i will try)
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
OSIRIS Grandmaster Cheater
Reputation: 0
Joined: 27 Aug 2006 Posts: 654
|
Posted: Tue Mar 11, 2008 8:35 am Post subject: |
|
|
| Code: | Dim FILE_NAME As String = "C:\test5.txt"
Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
objWriter.Write("TEXT FOR FILE GOES HERE")
objWriter.Close()
MsgBox("Text written to file") |
Play around with this code. This one is just without all the variables
|
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Tue Mar 11, 2008 8:37 am Post subject: |
|
|
| Code: | | Dim objWriter As New System(IO.StreamWriter(location)) |
try
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
OSIRIS Grandmaster Cheater
Reputation: 0
Joined: 27 Aug 2006 Posts: 654
|
Posted: Tue Mar 11, 2008 8:39 am Post subject: |
|
|
| haxory' wrote: | | Code: | | Dim objWriter As New System(IO.StreamWriter(location)) |
try |
I get the blue line
|
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Tue Mar 11, 2008 8:44 am Post subject: |
|
|
hmm sorry i dont know it then
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
OSIRIS Grandmaster Cheater
Reputation: 0
Joined: 27 Aug 2006 Posts: 654
|
Posted: Tue Mar 11, 2008 8:46 am Post subject: |
|
|
| haxory' wrote: | | hmm sorry i dont know it then |
I just tried modifing the directory so My Documents and it worked I guess you just can't put txt files in the c drive. See my new code it worked.
| Code: |
Dim FILE_NAME As String = "C:\Users\Stefon\Documents\test9.txt"
Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
objWriter.Write("HI")
objWriter.Close()
MsgBox("Text written to file")
|
|
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Tue Mar 11, 2008 8:53 am Post subject: |
|
|
ok nice.
have fun with it
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
OSIRIS Grandmaster Cheater
Reputation: 0
Joined: 27 Aug 2006 Posts: 654
|
Posted: Tue Mar 11, 2008 8:59 am Post subject: |
|
|
| haxory' wrote: | ok nice.
have fun with it |
now I have to rewrite my whole program
|
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Tue Mar 11, 2008 9:28 am Post subject: |
|
|
i wish you success
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
|