我有一个 VB6 程序,可以将文本框中的文本保存到文件中,当你再次打开它时,相同的文本会在那里,但是每当我重新打开它时,文本框文本现在都有引号,我怎么能删除引号?代码是:
Private Sub Form_Load()
On Error GoTo NoFile
Randomize
Dim sFile As String
Dim Blank As String
Dim c1Path As String
Dim iFileNum As Integer
sFile = "C:\JPLData"
iFileNum = FreeFile
Open sFile For Input As iFileNum
Line Input #iFileNum, c1Path
Close #iFileNum
Text1.Text = c1Path
NoFile:
If Err.Number = 5 Then
sFile = "C:\JPLData"
c1Path = "No Custom Defined."
iFileNum = FreeFile
Open sFile For Output As iFileNum
Write #iFileNum, Text1.Text
Close #iFileNum
End If
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim sFile As String
Dim cName As String
Dim iFileNum As Integer
sFile = "C:\JPLData"
cName = vbClrf & Text1.Text & vbClrf
iFileNum = FreeFile
Open sFile For Output As iFileNum
Write #iFileNum, cName
Close #iFileNum
End Sub
编辑:我已经回答了我自己的问题,我拼错了 vbCrLf,并且我忘记添加 BLsnk 变量来处理引号:P