How do i make an HTML Editor + a Live HTML/Page Editor.
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
6 posts
Page 1 of 1
The last topic i did i fixed my self after thinking for like 1 Min :/ but i really need help with this. i did one before and it edited the DocumentTxt but did not save or edit correctly.
Help.
Help.
You don't need the webbrowser's document text.
You can use a RichTextBox or any other text control to edit the HTML file, you can use code to have the path and name set so you can save the file without any dialogs, then navigate your webbrowser to the file.
I've just written a small application for you, it saves a file named index.html to the desktop, no dialogs in the way, as soon as you make a change it displays it in the webbrowser.
screenshot:
code:
Need anymore help or have any questions ask me, +rep if I've helped
You can use a RichTextBox or any other text control to edit the HTML file, you can use code to have the path and name set so you can save the file without any dialogs, then navigate your webbrowser to the file.
I've just written a small application for you, it saves a file named index.html to the desktop, no dialogs in the way, as soon as you make a change it displays it in the webbrowser.
screenshot:

code:
Code: Select all
Public Class Form1
'Our declarations, this is going to be the path and file name for our HTML file'
Dim _path As String
Dim _name As String
Private Sub RichTextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles RichTextBox1.TextChanged
'try catch in case of any errors'
Try
'we save the file with the path and name we declared and save it as plain text, then navigate to the file with the webbrowser'
RichTextBox1.SaveFile(_path & _name, RichTextBoxStreamType.PlainText)
WebBrowser1.Navigate(_path & _name)
Catch ex As Exception
End Try
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'set the path and name on our load event'
_path = My.Computer.FileSystem.SpecialDirectories.Desktop
_name = "/index.html"
End Sub
End Class
Need anymore help or have any questions ask me, +rep if I've helped

You do not have the required permissions to view the files attached to this post.
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
smashapps wrote:You don't need the webbrowser's document text.Thanks for your help but i didnt mean that i dont want to edit a BLANK html i want to have lets say Youtube and i want to be able to open the html of that site and edit it......
You can use a RichTextBox or any other text control to edit the HTML file, you can use code to have the path and name set so you can save the file without any dialogs, then navigate your webbrowser to the file.
I've just written a small application for you, it saves a file named index.html to the desktop, no dialogs in the way, as soon as you make a change it displays it in the webbrowser.
screenshot:
![]()
code:
Code: Select allPublic Class Form1 'Our declarations, this is going to be the path and file name for our HTML file' Dim _path As String Dim _name As String Private Sub RichTextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles RichTextBox1.TextChanged 'try catch in case of any errors' Try 'we save the file with the path and name we declared and save it as plain text, then navigate to the file with the webbrowser' RichTextBox1.SaveFile(_path & _name, RichTextBoxStreamType.PlainText) WebBrowser1.Navigate(_path & _name) Catch ex As Exception End Try End Sub Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load 'set the path and name on our load event' _path = My.Computer.FileSystem.SpecialDirectories.Desktop _name = "/index.html" End Sub End Class
Need anymore help or have any questions ask me, +rep if I've helped
Ive looked up tutorials and they all came out like urs :/
If you want to alter the page without having to reload the whole document, you will need to make use of the existing HTML elements.
You can access these with GetElementById and GetElementsByTagName.
You can access these with GetElementById and GetElementsByTagName.
mandai wrote:If you want to alter the page without having to reload the whole document, you will need to make use of the existing HTML elements.If i knew how to do that i would have done it wouldnt i?
You can access these with GetElementById and GetElementsByTagName.
If you are looking to list the elements and alter their attributes/inner HTML then you can use this:
Code: Select all
Where listElements is a ListBox. Private Sub WebBrowser1_DocumentCompleted(sender As System.Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
listElements.Items.Clear()
For i As Integer = 0 To WebBrowser1.Document.All.Count - 1
listElements.Items.Add(WebBrowser1.Document.All(i).TagName)
Next
End Sub
Private Sub btnSetAttribute_Click(sender As System.Object, e As System.EventArgs) Handles btnSetAttribute.Click
If Not WebBrowser1.Document Is Nothing Then
WebBrowser1.Document.All(listElements.SelectedIndex).SetAttribute(txtAttribute.Text, txtValue.Text)
End If
End Sub
Private Sub btnSetHTML_Click(sender As System.Object, e As System.EventArgs) Handles btnSetHTML.Click
If Not WebBrowser1.Document Is Nothing Then
WebBrowser1.Document.All(listElements.SelectedIndex).InnerHtml = txtValue.Text
WebBrowser1_DocumentCompleted(Nothing, Nothing)
End If
End Sub
6 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023