-  [JOIN IRC!]


[Return]
Posting mode: Reply
Name
Subject   (reply to 126)
Message
File
Password  (for post and file deletion)
¯\(°_O)/¯
  • Supported file types are: BMP, GIF, JPG, PNG
  • Maximum file size allowed is 10000 KB.
  • Images greater than 400x400 pixels will be thumbnailed.
  • Currently 317 unique user posts. View catalog

  • Blotter updated: 2015-09-02 Show/Hide Show All


File 133217794468.jpg - (20.93KB , 420x245 , error70.jpg )
126 No. 126
So I'm a rookie programmer trying to make a program that creates text files and then reads and writes data to them. I've got everything down but the writing part. Currently I get errors when I try to write to my text files. The most common of witch is error 70. I've been stuck with this problem for 3 days now and I was wondering if any of ya all could help me out.

O ya this is the bit of code I have been working with.

Private Sub cmdCreateFile_Click()


'Data for text file

Dim strName As String
Dim strSoul As String
Dim strBody As String
Dim strMind As String

strName = txtName.Text
strSoul = txtSoul.Text
srtBody = txtBody.Text
strMind = txtMind.Text

'Creates Text File-----------------------------------------

Dim strFilePath As String
strFilePath = App.Path & "\Data\Characters\" & txtName.Text & ".txt"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(strFilePath)

'Fails To write data---------------------------------

Open strFilePath For Output As #2
Write #2, strName


End Sub


Thanks for any help you all can give me, its much appreciated.
>> No. 127
The two "Set obj..." lines need to be removed. Those look more like what's used in VBScripts, and in this case the objFile is keeping the file open so that the normal way (using Open) can't access it. All you should need for file writing is an Open, Write, and Close command.
>> No. 128
Thanks, I was lucky enough to figure out how to use the close commands and have got things working.
Its a bit clunky still. Now I just need to figure out the write commands. I'm not looking for a way to write on several lines rather than having one very long line of text on my file.
>> No. 129
Check that. I got that working too now. :) Now just to start moving this data around.
>> No. 130
#!/bin/bash
echo "what" > a.txt; cat a.txt


Delete post []
Password  
Report post
Reason