none
Web Browser Project

    Question

  • I am writing a web browser, I remember asking for help about a problem with the browser itself. I originally intended this browser to be more intuitive and cool than a 5-minute web browser takes (things more advanced than just back and forward buttons). But it is not the actual browser I am having trouble with. Part of the web browser is having a basic utility for parsing\loading\saving HTML. Anyway, to the point:

    Files created in this utility then loaded at a later date work fine, but if it's a file that was not created with this utility (created with notepad, saved off the internet, ect.), the text appears until <!-- , after that the text just stops even though when you open it with notepad or another text editor, there is more to the file. If it doesn't have <!-- , the whole file loads fine. I would be happy to provide form1 code as a text document, and the compiled EXE if someone just told me how to post attachments

    This is the code of the only form I have:

    Public Class Form1
        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            WebBrowser1.DocumentText = TextBox1.Text
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            If My.Settings.automaticHTMLparsing = True Then
                Me.RadioButton1.Checked = True
                Me.RadioButton2.Checked = False
                Me.Button3.Hide()
                Me.Timer1.Enabled = True
            Else
                Me.RadioButton1.Checked = False
                Me.RadioButton2.Checked = True
                Me.Button3.Show()
                Me.Timer1.Enabled = False
            End If
        End Sub
    
        Private Sub RadioButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.Click
            My.Settings.automaticHTMLparsing = True
            My.Settings.Save()
            Me.Button3.Hide()
            Me.Timer1.Enabled = True
        End Sub
    
        Private Sub RadioButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.Click
            My.Settings.automaticHTMLparsing = False
            My.Settings.Save()
            Me.Button3.Show()
            Me.Timer1.Enabled = False
        End Sub
    
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            WebBrowser1.DocumentText = TextBox1.Text
        End Sub
    
        Private Sub RadioButton1_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.MouseEnter
            Me.Label1.Text = "If HTML parsing is set to automatic, the code will re-parse every 5 seconds."
        End Sub
    
        Private Sub RadioButton1_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.MouseLeave
            Me.Label1.Text = ""
        End Sub
    
        Private Sub RadioButton2_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.MouseEnter
            Me.Label1.Text = "If HTML parsing is set to manual, the code will not re-parse until you press the update HTML button."
        End Sub
    
        Private Sub RadioButton2_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.MouseLeave
            Me.Label1.Text = ""
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            SaveFileDialog1.Title = "Save HTML File"
            SaveFileDialog1.FileName = "Untitled"
            SaveFileDialog1.Filter = "Web Page File (*.html)|*.html|Web Page File (*.htm)|*.htm"
            SaveFileDialog1.ShowDialog()
            If SaveFileDialog1.FileName <> "" Then
                FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)
                PrintLine(1, TextBox1.Text)
                FileClose(1)
            End If
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Dim alltext As String = "", lineoftext As String = ""
            OpenFileDialog1.Title = "Open HTML File"
            OpenFileDialog1.FileName = "Untitled"
            OpenFileDialog1.Filter = "Web Page File (*.html)(*.htm)|*.html;*.htm|All Files (*.*)|*.*"
            OpenFileDialog1.ShowDialog()
            If OpenFileDialog1.FileName <> "" Then
                FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input)
                lineoftext = LineInput(1)
                alltext = alltext & lineoftext & vbCrLf
                TextBox1.Text = alltext
                FileClose(1)
                WebBrowser1.DocumentText = TextBox1.Text
            End If
        End Sub
    End Class
    
    Saturday, August 29, 2009 10:20 PM

Answers

  • Colin Verhey , not really understanding your question..
    giving it a shot..

    if you open a html file in your vb.net webbrowser and it contains <!--, your file does not display correctly, correct?
    if so, add a link to a webpage that contains this text in the html code, for further forum evalution.

    or is your file you are trying to load, not .html, but .txt, or other?


    i live here and this is my reason ... trujade.
    Saturday, August 29, 2009 11:20 PM