HTML Editor

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.
2 posts Page 1 of 1
Contributors
User avatar
corliansa
Just Registered
Just Registered
Posts: 2
Joined: Sat Oct 13, 2012 9:19 am

HTML Editor
corliansa
Hello All!
Well, i create this app for designing my website.
the function of this app is Load,Save,Preview it is not very helpful but it is good for me.
i will add new function next time.

let's start

Design :

1. We need:
[*] 3 Button
[*] 1 RichTextBox

2. Options
[*] Form size: 724; 539
[*] Button1(Save) , size = 75; 30 , location = 0; 2
[*] Button2(Load From File) , size = 108; 30 , location = 74; 2
[*] Button3(Preview) , size = 75; 30 , location = 181; 2
[*] RichTextBox1 , size = 708; 468 , location = 0; 33 , name = TextHT

Code :

1.Button1 Code :
Code: Select all
Dim svHT As New SaveFileDialog
        svHT.Filter = "HTML Files(*.html)|*.html"
        svHT.FileName = ""
        If (svHT.ShowDialog = Windows.Forms.DialogResult.OK) Then
            MessageBox.Show("File Saved!", "Message", MessageBoxButtons.OK)
        End If
2.Button2 Code :
Code: Select all
Dim ldHT As New OpenFileDialog
        ldHT.Filter = "All Files|*.*|HTML Files(*.html)|*.html"
        ldHT.FileName = ""
        If (ldHT.ShowDialog = Windows.Forms.DialogResult.OK) Then
            Dim srHT As String = My.Computer.FileSystem.ReadAllText(ldHT.FileName)
            TextHT.Text = srHT
        End If
3.Button3 Code :
Code: Select all
With TextHT
            Dim s As String = TextHT.Text
            My.Computer.FileSystem.WriteAllText(Application.StartupPath & "\cache.html", s, False)
        End With
        System.Diagnostics.Process.Start(Application.StartupPath & "\cache.html")
All Code :
Code: Select all
Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim svHT As New SaveFileDialog
        svHT.Filter = "HTML Files(*.html)|*.html"
        svHT.FileName = ""
        If (svHT.ShowDialog = Windows.Forms.DialogResult.OK) Then
            MessageBox.Show("File Saved!", "Message", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim ldHT As New OpenFileDialog
        ldHT.Filter = "All Files|*.*|HTML Files(*.html)|*.html"
        ldHT.FileName = ""
        If (ldHT.ShowDialog = Windows.Forms.DialogResult.OK) Then
            Dim srHT As String = My.Computer.FileSystem.ReadAllText(ldHT.FileName)
            TextHT.Text = srHT
        End If
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        With TextHT
            Dim s As String = TextHT.Text
            My.Computer.FileSystem.WriteAllText(Application.StartupPath & "\cache.html", s, False)
        End With
        System.Diagnostics.Process.Start(Application.StartupPath & "\cache.html")
    End Sub
End Class
if you don't understand, you can download the attachment :
HTCreator.zip
You do not have the required permissions to view the files attached to this post.
User avatar
Shim
VIP - Donator
VIP - Donator
Posts: 882
Joined: Wed Dec 14, 2011 5:02 am

Re: HTML Editor
Shim
nice tutorial , well explained :) go to viewforum.php?f=16 and make a introduction

+rep

Edit : Oh I see your the owner of http://www.corliansa.com/ cooll;
Find my programs on Softpedia
2 posts Page 1 of 1
Return to “Tutorials”