Results 1 to 8 of 8

Thread: [Question] Creating Web Browser

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    5

    [Question] Creating Web Browser

    Hi all,

    we have a little tool in our company but the developer left no source code and can no longer be contacted.

    basically I would like to create a Web Browser that displays the Content in it's screen.

    I started like this:
    Code:
        WebBrowser1.Navigate(TextBox1.Text)
        End Sub
    
        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            WebBrowser1.GoForward()
        End Sub
    
        Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
    
        End Sub
    End Class
    The 1st Struggle already is that hitting Enter after adding the Address does not display the content. I need to click on the Search Button.

    Additionally it would be nice if the Address is an IP Address that the last Part of the IP address could automatically be incremented and show the next Device in the Browser.

    Any hints?

    THX

    PT-1

  2. #2
    New Member
    Join Date
    Feb 2010
    Posts
    13

    Re: [Question] Creating Web Browser

    As far as the pressing enter in the textbox goes try this code in the textbox's keydown event:

    Code:
    If e.KeyCode = Keys.Enter Then
        'Runs the Button1_Click Event
        Button1_Click(Me, EventArgs.Empty)
    end if
    I'm not sure what exactly you mean with the IP addresses however

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    5

    Re: [Question] Creating Web Browser

    Quote Originally Posted by Bewl View Post
    As far as the pressing enter in the textbox goes try this code in the textbox's keydown event:

    Code:
    If e.KeyCode = Keys.Enter Then
        'Runs the Button1_Click Event
        Button1_Click(Me, EventArgs.Empty)
    end if
    I'm not sure what exactly you mean with the IP addresses however
    Like this?

    Code:
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
            If e.KeyCode = Keys.Enter Then
                'Runs the Button1_Click Event
                Button1_Click(Me, EventArgs.Empty)
            End If
        End Sub
    Does not work....

    IP Address for example

    I browse to 192.168.178.14 and want a button and then be on 192.168.178.15

    THX

    PT-1

  4. #4
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: [Question] Creating Web Browser

    we have a little tool in our company but the developer left no source code and can no longer be contacted.
    Is it a VB .NET application? if so, it's likely that you can decompile it via red gate's reflector.
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  5. #5
    New Member
    Join Date
    Feb 2010
    Posts
    13

    Re: [Question] Creating Web Browser

    Quote Originally Posted by pt-1 View Post
    Like this?

    Code:
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
            If e.KeyCode = Keys.Enter Then
                'Runs the Button1_Click Event
                Button1_Click(Me, EventArgs.Empty)
            End If
        End Sub
    Does not work....
    You need to put that code into the TextBox1 "KeyDown" event, not "TextChanged"

  6. #6

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    5

    Re: [Question] Creating Web Browser

    Hi all,

    I had a few busy days so I could only test this yesterday.
    The following code works:

    Code:
    Public Class Browser
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            WebBrowser1.Navigate(TextBox1.Text)
    
        End Sub
    
        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    
        End Sub
    
        Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
            If e.KeyCode = Keys.Enter Then
                'Runs the Button1_Click Event
                Button1_Click(Me, EventArgs.Empty)
            End If
        End Sub
    
        Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
    
        End Sub
    
    End Class
    How can I now change the code to create a Button to either increase or decrease the IP address by +1 or -1?



    and additionally add a few Buttons that add a /URL behind the IP?



    THX for any Ideas ;-)

    PT-1

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    5

    Re: [Question] Creating Web Browser

    Using Reflector I actually managed to have a look at the "old" Software and found the code to add a /URL behind the IP address I already have in the txt Box.

    Now all I need to do is understand the code and modify to fit with my code ;-)

    Code:
    Private Sub radioButton1_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
        Dim text As String = Me.textBox1.Text
        Dim index As Integer = [text].IndexOf("/")
        If (index <> -1) Then
            Me.textBox1.Text = ([text].Substring(0, index) & "/!mem")
        Else
            Me.textBox1.Text = (Me.textBox1.Text & "/!mem")
        End If
        Me.sendToBrowser(Me.textBox1.Text)
    End Sub
    Still searching for the increase and decrease Buttons ....

  8. #8

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    5

    Re: [Question] Creating Web Browser

    anyone ..?

    I am lost

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width