 |
 |

01-28-2004, 09:30 AM
|
|
Regular
|
|
Join Date: Nov 2003
Posts: 69
|
|
Data Format when writting to a text file
|
All,
I have a program that will write data to a text file, then read the text file and load the data into textboxes on my form. Problem i have is when the data is written to the text file, it is put in quotes, and loaded with the quotes. I need to be able to save the data to a text file with out quote. Here is my code:
Private Sub Command1_Click()
Dim strFile As String
Dim Program_Name As String
strFile = App.Path & "\inidata.ini"
Call dhWriteAndInput(strFile)
End Sub
'--------------------------------------------------------------
Private Sub dhWriteAndInput(strFile As String)
On Error GoTo ErrorHandler
Dim hFile As Long
ReDim varData(1 To 5) As Variant
Dim i As Integer
'Open a file for output, write to it and close it
hFile = FreeFile
Open strFile For Output Access Write As hFile
Write #hFile, Text1.Text
Write #hFile, Text2.Text
Close hFile
'Now open it back up for reading
hFile = FreeFile
Open strFile For Input Access Read As hFile
Input #hFile, varData(1), varData(2), varData(3), varData(4), varData(5)
Close hFile
ErrorHandler:
Select Case Err.Number ' Evaluate error number.
Case 53 ' "File NetManage.ini does not exist on C:\"
MsgBox "File NetManage.ini does not exist on C:\"
Case 55 ' "File already open" error.
Close #1 ' Close open file.
Case Else
' Handle other situations here...
End Select
Resume Next
End Sub
My text file content will look like this when completed.
"text1"
"text2"
How do i get it to look like this ? (With out quotes)
text1
text2
TIA
Drum
|
|

01-28-2004, 10:45 AM
|
 |
Sinecure Expert
Super Moderator * Guru *
|
|
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,714
|
|
|
If you don't want the quotes, use "Print #" instead of "Write #".
|
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
|

01-30-2004, 01:30 AM
|
 |
Contributor
|
|
Join Date: Sep 2003
Location: Lenoir, NC - USA
Posts: 731
|
|
|

01-30-2004, 06:33 PM
|
 |
Sinecure Expert
Super Moderator * Guru *
|
|
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,714
|
|
|
Put # would only work if the file was open for Binary or Random, not Output.
Put #, will also write numeric type numbers as a binary image and would
not be readable as a text file.
|
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|