how to store two text box value to single text file
Hello i m jst a new bee in coding so i need a lil bit favour of urs ... all i want to do is i need to store two text box value to single text file!!!sry if the thread post earliar in the forum!!!i hav checked other soluttions bt can't figure out wats goin wrong with this code ... thanks in advance
Dim a As New FileSystemObject, data As TextStream
Dim text As String
Dim text1 As TextBox
text = txtMsg.Text
data = a.CreateTextFile("C:\test.txt")
data.WriteLine(text)
n i got error like dis
"""Object reference not set to an instance of an object.""""
this is wat i m getting although it's not an error it's a warnig message but program terminates after this message .. n i'm trying 2 sort out d problem i want 2 ask u quetion that is it possible because i'm writing
data.WriteLine(text)
multiple times in more than one text boxes???? n is it possible to store more than one data in the txt file???
for an example i want 2 store phone number, message , time like this
90XXXXXXXX,hello, time
90XXXXXXXX,hi, time
eagerly waiting for ur reply
Re: how to store two text box value to single text file
Here you go!
vb Code:
Private Sub Write_Click()
Dim sFileText As String
Dim iFileNo As Integer
iFileNo = FreeFile
'open the file for writing
Open "C:\Test.txt" For Output As #iFileNo
Print #iFileNo, nnbox.Text & "," & " " & nbox.Text & "," & " " & mbox.Text
Close #iFileNo
End Sub
Re: how to store two text box value to single text file
To help make your code easier for others to read please wrap it in [highlight="vb"][/highlight] tags.
2 Attachment(s)
Re: how to store two text box value to single text file
thank you sir but i m still getting errors ..... i dn't know the code u gave is for vb.net or vb6 .... i am using vb.net hope this makes u 2 understand my problem thank you ... here with i m uploading two images ....1st image test.rar was my today's invention and 2nd file recently created is ur suggestion mr nemo ....
Re: how to store two text box value to single text file
Quote:
Originally Posted by
hardygandhi
i dn't know the code u gave is for vb.net or vb6 .... i am using vb.net
Thread moved from 'VB6 and Earlier' forum to 'VB.Net' forum