Newbie Needs to read entire text file, display it to a textBox, be able to edit the text box and save any changes to same text file

I am very new at programming.
I am creating an app and need help on a couple of things.
I need to be able to read an entire already existing text file and display it in a textBox.
In this same textBox I need to be able to edit whats in the textBox and save it back to the original text file.
Any help would be appreciative.
jettman26Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

amyhxuCommented:
This link has all the examples of creating(in your case, you don't need to create), reading, writing a text file:
http://www.builderau.com.au/program/windows/0,39024644,20267367,00.htm
0
amyhxuCommented:
0
Anil_PooniaCommented:
Hi jettman26

Try this one

Private Sub SaveToFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToFile.Click
        Dim Write As String
        Dim sw As New StreamWriter("c:\my.txt", False)
        Write = Trim(RichTextBox1.Text)
        sw.WriteLine(Write)
        sw.Close()
        RichTextBox1.Text = ""
    End Sub

    Private Sub ReadFrmFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReadFrmFile.Click
        Dim read As String
        Dim sr As New StreamReader("c:\my.txt")
        RichTextBox1.Text = sr.ReadToEnd

        sr.Close()
    End Sub


With Refards

Anil
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Anil_PooniaCommented:
Before use this code pls use following line

Imports System.IO

0
Fahad MukhtarDistinguished EngineerCommented:
use a RichtextBox Control, then you can use the builtin LoadFile() and SaveFile Methods for your problem:

'1 line code to Load a text file in Rich TextBox
RichTextBox1.LoadFile("C:\New Text Document.txt", RichTextBoxStreamType.PlainText)

'1 line code to save the same text file from Rich TextBox
RichTextBox1.SaveFile("C:\New Text Document.txt", RichTextBoxStreamType.PlainText)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
planoczCommented:
Hi,

Here is where I found good examples for getting started in VB.Net

.....http://msdn.microsoft.com/vbasic/downloads/samples/101samples.aspx

Link for ASP programs...

http://msdn.microsoft.com/asp.net/downloads/kits/default.aspx 
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.