[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
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
Re: [Question] Creating Web Browser
Quote:
Originally Posted by
Bewl
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
Re: [Question] Creating Web Browser
Quote:
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.
Re: [Question] Creating Web Browser
Quote:
Originally Posted by
pt-1
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"
Re: [Question] Creating Web Browser
:rolleyes: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?
http://img189.imageshack.us/img189/4482/browserj.jpg
and additionally add a few Buttons that add a /URL behind the IP?
http://img17.imageshack.us/img17/3818/browser02.jpg
THX for any Ideas ;-)
PT-1
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 ....
Re: [Question] Creating Web Browser