Go Back   Computer Forums > General Computing > Programming
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 01-23-2009, 12:12 PM   #11
In Runtime
Daeva's Avatar
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default Re: Edit a HTML Template?

All you need is a Windows Form named Form1, with 3 textboxes and a button. You can name them the same as the button names I have, or change my button names, but this is all you need.

Imports System
Imports System.IO

Public Class Form1

    Private _htmlString As String = ""
    Private _imageHTML As String = ""
    Private _descriptionHTML As String = ""
    Private _postageCostHTML As String = ""

    Private Sub CreateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateButton.Click
        _imageHTML = "<img src=""" & Me.ImageUrlTextBox.Text() & """ alt=""My Product"" />"
        _descriptionHTML = "<p style="""">" & Me.DescriptionTextBox.Text() & "</p>"
        _postageCostHTML = "<span style="""">" & Me.PostageTextBox.Text() & "</span>"
        _htmlString = _imageHTML & Environment.NewLine() & _descriptionHTML & Environment.NewLine() & _postageCostHTML & Environment.NewLine()
        SaveFileDialog1.DefaultExt() = ".html"
        SaveFileDialog1.Filter = "HTML Files (*.html)|*.html|All files (*.*)|*.*"
    End Sub

    Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk
        Dim _stream As Stream
        _stream = File.Create(DirectCast(sender, SaveFileDialog).FileName())
        Dim sw As New StreamWriter(_stream)
        Dim _res As MsgBoxResult = MsgBox("File Operation Complete, would you like to do another?", MsgBoxStyle.YesNo, "Complete")
        If _res = MsgBoxResult.Yes Then
            Me.DescriptionTextBox.Text() = ""
            Me.PostageTextBox.Text() = ""
            Me.ImageUrlTextBox.Text() = ""
        End If

    End Sub
End Class
Once you click the button, it grabs the things you've entered into the form fields, combines them into one, and writes and html file at a location of your choice.

**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
Daeva is offline   Reply With Quote
Old 01-23-2009, 03:37 PM   #12
Neodude112320's Avatar
Join Date: Feb 2006
Location: Australia
Posts: 8,471
Send a message via MSN to Neodude112320
Default Re: Edit a HTML Template?


You are the **MAN** - WORKS Perfect! Now i have the code i can customize it! Thanks HEAPS!

Desktop:BitFenix Survivor~Gigabyte GA-P67A-UD3R~ i7 2600K @ 4hz~AMD 6870 1GB~12gb Team Elite DDR3 1333~3xWD In RAID5~W7 Ult
Laptop:Alienware M11x~ i7-2637M 1.7GHz~16GB 1333MHz DDR3~GeForce GT 540M~W7 Ult
Neodude112320 is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 12:22 PM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0