Page 1 of 1

Visual Basic 2005 Tutorial: Making a Text Editor

Posted: Wed Jun 29, 2005 3:46 pm
by Cheech|N|Chong
Ok, I got around to making the tutorial for the Text Editor so here it is:

Heres the needed code for the steps [Since you cant copy text from an image]

For step 4:

Code: Select all

 Dim Open As New OpenFileDialog()
        Dim myStreamReader As System.IO.StreamReader

        Open.Filter = "Plain Text Files (*.txt)|*.txt|All files (*.*)|*.*"
        Open.CheckFileExists = True
        Open.Title = "Open Text Files"
        Open.ShowDialog(Me)
        Try
            Open.OpenFile()
            myStreamReader = System.IO.File.OpenText(Open.FileName)
            Textbox1.Text = myStreamReader.ReadToEnd()
        Catch ex As Exception
            ' Do nothing on Exception
        End Try
For step 5:

Code: Select all

 Dim SaveText As New SaveFileDialog()
        Dim myStreamWriter As System.IO.StreamWriter

        SaveText.Filter = "Plain Text Files (*.txt)|*.txt|All files (*.*)|*.*"
        SaveText.CheckPathExists = True
        SaveText.Title = "Save Your Text"
        SaveText.ShowDialog(Me)

        Try
            myStreamWriter = System.IO.File.AppendText(SaveText.FileName)
            myStreamWriter.Write(Textbox1.Text)
            myStreamWriter.Flush()
        Catch ex As Exception
            ' Do Nothing
        End Try
Step 6 and Step 7 are only a couple words so just write what you see...

Posted: Wed Jun 29, 2005 3:47 pm
by Cheech|N|Chong
Image

Posted: Wed Jun 29, 2005 3:47 pm
by Cheech|N|Chong
Image