BP Forums
External Settings File - Printable Version

+- BP Forums (https://bpforums.info)
+-- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=55)
+--- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=56)
+---- Forum: VB.NET (Visual Basic 2010/2008) (https://bpforums.info/forumdisplay.php?fid=8)
+----- Forum: Programming Help (https://bpforums.info/forumdisplay.php?fid=9)
+----- Thread: External Settings File (/showthread.php?tid=421)



External Settings File - brco900033 - 11-04-2011

I need some help with a code, how can I save the text from a RichTextBox to a TXT document? I have tried the following code but when I open the TXT Document there comes a strange code!
Code:
My.Forms.main.txt_text.SaveFile("C:\Program Files\info\Text.txt", RichTextBoxStreamType.RichText)


And then I have a second question:
How can I make a code so that for example the setting 'Text' contains the text from the saved TXT Document above?


Re: External Settings File - brandonio21 - 11-04-2011

How to save a file
Code:
Dim writer as new system.io.streamwriter("PATH")
writer.write("TEXT")
writer.close()
How to read a file
Code:
Dim text as string
dim reader as new system.io.streamreader("PATH")
text = reader.readToEnd()
reader.close()