HTML Editor + Preview

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
4 posts Page 1 of 1
Contributors
User avatar
volttide
VIP - Donator
VIP - Donator
Posts: 106
Joined: Mon Jan 17, 2011 8:24 am

HTML Editor + Preview
volttide
in form1 you'll need:
1-richtextbox dock:fill
1-menustrip
1-savefiledialog filter: .html|*html
1-openfiledialog filter: .html|*html
in form2 you'll need:
1-webbrowser dock:fill
the result image:
form1:
2011-04-03 15h06_05.png
in menustrip1 you'll need to rename menu & tool
in menu there are:
-Preview
-Clear all
-Exit
in tool there are:
Open
Save
Undo
Redo
Cut
Copy
Paste

code:

the full code:
Code: Select all
Public Class Form1

    Private Sub PreviewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PreviewToolStripMenuItem.Click
        Form2.Show()
    End Sub

    Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim SaveFile As New SaveFileDialog
        SaveFile.FileName = ""
        SaveFile.Filter = "Text Files (*.html)|*.html"
        SaveFile.Title = "Save"
        SaveFile.ShowDialog()
        Try
            Dim Write As New System.IO.StreamWriter(SaveFile.FileName)
            Write.Write(RichTextBox1.Text)
            Write.Close()
        Catch ex As Exception
        End Try
    End Sub

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub ClearAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearAllToolStripMenuItem.Click
        RichTextBox1.Text = ""
    End Sub

    Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
        Form2.WebBrowser1.DocumentText = RichTextBox1.Text
    End Sub

    Private Sub OpenToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem1.Click
        Dim OpenFile As New OpenFileDialog
        OpenFile.FileName = ""
        OpenFile.Filter = "Text Files (*.html)|*.html"
        OpenFile.Title = "HTML"
        OpenFile.ShowDialog()
        Try
            Dim Read As New System.IO.StreamReader(OpenFile.FileName)
            RichTextBox1.Text = Read.ReadToEnd
            Read.Close()
        Catch ex As Exception
        End Try
    End Sub

    Private Sub SaveToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem1.Click
        Dim SaveFile As New SaveFileDialog
        SaveFile.FileName = ""
        SaveFile.Filter = "Text Files (*.html)|*.html"
        SaveFile.Title = "Save"
        SaveFile.ShowDialog()
        Try
            Dim Write As New System.IO.StreamWriter(SaveFile.FileName)
            Write.Write(RichTextBox1.Text)
            Write.Close()
        Catch ex As Exception
        End Try
    End Sub

    Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem.Click
        RichTextBox1.Undo()
    End Sub

    Private Sub RedoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem.Click
        RichTextBox1.Redo()
    End Sub

    Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click
        RichTextBox1.Cut()
    End Sub

    Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click
        RichTextBox1.Copy()
    End Sub

    Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click
        RichTextBox1.Paste()
    End Sub
End Class
Download the exe:

This file is hosted off-site.
You do not have the required permissions to view the files attached to this post.
User avatar
Scottie1972
Codenstuff Elite
Codenstuff Elite
Posts: 953
Joined: Thu Jan 14, 2010 5:48 am

Re: HTML Editor + Preview
Scottie1972
I really like the FormBorder that you made. Very Cool looking...
But I think you should do alot more to this project.
I seems to be more of a NotePad.exe then anything thing else.
Image
User avatar
Axel
Coding God
Coding God
Posts: 1928
Joined: Sun Jun 27, 2010 9:15 pm

Re: HTML Editor + Preview
Axel
I think its his theme .
http://vagex.com/?ref=25000
User avatar
volttide
VIP - Donator
VIP - Donator
Posts: 106
Joined: Mon Jan 17, 2011 8:24 am

Re: HTML Editor + Preview
volttide
yes, its my theme
4 posts Page 1 of 1
Return to “Tutorials”