Code: Write the txtFirstName.text to text file (a.txt) and read from
the text file and show on the txtMsg.text
-------------------------------------------------------------------
Option Explicit
Private Sub btnRead_Click()
Dim sFile As String
Dim sText As String
Dim iFileNum As Integer
sFile = "C:\Documents and Settings\user\Desktop\Testing\a.txt"
iFileNum = FreeFile
Open sFile For Input As iFileNum
Input #iFileNum, sText
Close #iFileNum
//* Read from the text file and show the content into the text
box*//
txtMsg.Text = sText
End Sub
Private Sub btnWrite_Click()
Dim sFile As String
Dim sText As String
Dim iFileNum As Integer
sFile = "C:\Documents and Settings\user\Desktop\Testing\a.txt"
//* Write to the text file *//
sText = txtMsg.Text
iFileNum = FreeFile
Open sFile For Output As iFileNum
Write #iFileNum, sText
Close #iFileNum
End Sub
-------------------------------------------------------------------
Problem:
(1:) Type txtFirstName.Text = Peter, text file show: "Peter"
Read from text file and show : txtMsg.Text = Peter
..It is OK no problem.
(2:) When type: Peter into text file and read from the text file,
-------
the txtMsg.Text = Peter ....this is also normal....
BUT when I type: Peter love IP "10.11.12.13" Or Peter Love IP,
10.12.13.14 on text file, read from text file , the txtMsg.text ONLY
show: Peter love IP (the text behind the " and ,is not able to show
on the text box).
Question: Can I read the word or letter after the " and , from the
text box and show onto the text box without using the open and close
parentesis ???
@@@@@@@
(3) Dim strIP as String
strIP = "10.12.13.14"
txtMsg.Text = "I Love You""" & strIP &"""very much."
The file shown: "I Love You""10.12.13.14""very much."
Q: Can I write ONLY: I Love You"10.12.13.14"very much.(without "
and ") to the text file??
@@@@@@@