It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

Text File

Moderator: dafunkymunky

Re: Text File

Postby jblues on Tue May 03, 2011 5:08 pm

the strearwriter has to be declared as new in some versions
try this.

Dim sfds As New SaveFileDialog
sfds.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"
sfds.ShowDialog()

Dim objStreamWriter As New System.IO.StreamWriter(sfds.FileName)

objStreamWriter = System.IO.File.AppendText _
("file") ' this is where you put the name of the file.

objStreamWriter.WriteLine _
(RichTextBox1.Text & vbNewLine & RichTextBox2.Text)

objStreamWriter.Close()
jblues
 
Posts: 13
Joined: Tue May 03, 2011 11:08 am

Re: Text File

Postby Darren on Tue May 03, 2011 5:30 pm

jblues
No errors and the text file is created but nothing inside the file Regards
Darren
 
Posts: 13
Joined: Tue May 03, 2011 12:30 pm

Re: Text File

Postby jblues on Tue May 03, 2011 6:14 pm

What is the name and location of the text file.
jblues
 
Posts: 13
Joined: Tue May 03, 2011 11:08 am

Re: Text File

Postby Darren on Tue May 03, 2011 6:28 pm

jblues,
The file is called discop saved to Desktop
Darren
 
Posts: 13
Joined: Tue May 03, 2011 12:30 pm

Re: Text File

Postby jblues on Tue May 03, 2011 6:35 pm

delete the old codek, replace with this.
I am not sure if this is what you want to do, but it will work

Dim objStreamWriter As System.IO.StreamWriter

objStreamWriter = System.IO.File.AppendText _
("C:\Users\Admin\desktop\discop.txt") ' you will have to change the path

objStreamWriter.WriteLine _
(RichTextBox1.Text & vbNewLine & RichTextBox2.Text)

objStreamWriter.Close()


End Sub
jblues
 
Posts: 13
Joined: Tue May 03, 2011 11:08 am

Re: Text File

Postby Darren on Tue May 03, 2011 6:42 pm

Fantastic Thank you so much I really appreciate what you have done Brilliant Regards
Darren
 
Posts: 13
Joined: Tue May 03, 2011 12:30 pm

Previous

Who is online

Users browsing this forum: No registered users and 1 guest