Visual Basic Text Editor
Submitted by rinvizle on Thursday, September 15, 2016 - 14:04.
In this tutorial we will create a simple Text Editor using Visual Basic. This application that we create can perform a functions such as creating new documents by writing in the text field, modifying, deleting, searching, saving clear texts and finding texts within the text editor. It has a menu options that can import file, save, save as, and a exit button.
Save - And for the save function of files from the text editor.
Save As - For the save as function if you want it to save to another directory and another name.
Hope that you learn from this tutorial and don't forget to Like & Share this project and the website. Enjoy Coding...!
Sample Code
Import File - This code is for the importing of files from the explorer or the computer.- Dim fo As New OpenFileDialog
- fo.Filter = "Text Files|*.txt"
- fo.FilterIndex = 1
- fo.ShowDialog()
- If (fo.FileName = Nothing) Then
- Else
- path = fo.FileName
- Using sr As New StreamReader(fo.FileName)
- RichTextBox1.Text = sr.ReadToEnd()
- End Using
- End If
- If (Not path = Nothing) Then
- Using sw As New StreamWriter(path)
- sw.Write(RichTextBox1.Text)
- End Using
- End If
- Dim fs As New SaveFileDialog
- fs.Filter = "Text Files|*.txt"
- fs.FilterIndex = 1
- fs.ShowDialog()
- If (Not fs.FileName = Nothing) Then
- Using sw As New StreamWriter(fs.FileName)
- sw.Write(RichTextBox1.Text)
- End Using
- End If
Add new comment
- 187 views