-
I am writing a password program for my PC but when I open the text file and put the text (password) in to a string then save a different password it puts quote marks round the new password which means it wont work next time. how can I delete these quote marks or get
it so it doesn't read them in.
EG "password"
Thanks Jon
-
Use the Replace function.
Code:
Dim strPW As String
strPW = "EG" & Chr(34) & "password" & Chr(34)
strPW = Replace(strPW, Chr(34), "")
-
Could you post your password loading and saving code?
Sunny
-
No idea what you are talking about, but to read between the quotes, you can use Mid:
Code:
Dim strPW as String
strPW = Mid(Password, 2, Len(Password) - 1)
-
<?>
if you are writing to a text file with the Write Command
it will enclose the string in quotes...if you use the
Print Command to write it will not.
Open bla for bla as bla
Print #bla, mystring
close bla
No Quotes..
another way..if you use vb6 is the replace function.
Code:
Private Sub Command1_Click()
Dim mySting As String
mystring = """Help me out"""
MsgBox mystring
mystring = Replace(mystring, """", "")
MsgBox mystring
End Sub
-
Thanks everyone!
I swapped the write Statement for print and it worked perfectly.
sunnyl:
I'm not exactly sure what you mean but to open the text file and read the text into a string
I used:
Open "C:\pass.dat" For Input As #1
Input #1, password
Close #1
and to write the file back to the file:
Open "C:pass.dat" For Output As #2
Print #2, password
Close #2
Hope this helped
Jon