Is it possible for me to edit the System.Windows.Forms.Browser? If so, how can I do it?
Editing the webbrowser controlis it possible?
Page 1 of 1
7 Replies - 1364 Views - Last Post: 05 June 2009 - 12:51 AM
Replies To: Editing the webbrowser control
#2
Re: Editing the webbrowser control
Posted 03 June 2009 - 12:06 PM
No, you can't directly edit the control. It is a standard .NET library and you can only change its open properties in your own application.
#3
Re: Editing the webbrowser control
Posted 03 June 2009 - 01:14 PM
Do you mean edit the content of the displayed web page? Or enter text/clicks into a webage?
#4
Re: Editing the webbrowser control
Posted 03 June 2009 - 01:48 PM
What I am realy getting at is how can I change the dialog box which comes up on the download event?
#5
Re: Editing the webbrowser control
Posted 03 June 2009 - 01:51 PM
In this case you will probably have to handle web requests ( http://msdn.microsof...webrequest.aspx ). You will need to actually capture whenever a user presses a download link and then create a request by yourself instead of letting the control handle it.
#6
Re: Editing the webbrowser control
Posted 03 June 2009 - 05:32 PM
To play with web pages, you will usually need to look at the source to get things like the name of the input field. Problem is that not all websites consistently name their fields and buttons etc. You can use Focus() followed by SendKeys, but it is very unreliable!
Assuming you can get a name of the field, you can do the following:
Assuming you can get a name of the field, you can do the following:
... Dim mText As String = "text for box" Dim mField As String = "input_box" ' the name attribute in the HTML source Dim inputField As HtmlElement = Nothing ' Returns first element of that name - expected to be unique most times Dim elementsEnumerator As IEnumerator = elements.GetElementsByName(mField).GetEnumerator If elementsEnumerator.MoveNext() Then inputField = CType(elementsEnumerator.Current, HtmlElement) End If If Not IsNothing(inputField) Then inputField.InnerText = mText End If
#7
Re: Editing the webbrowser control
Posted 04 June 2009 - 04:46 AM
I have this code which I am trying to use, which cancels the Link Click event on my browser:
But it does not work
Has anyone got any ideas?
Private Sub LinkClicked(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
href = Me.document.ActiveElement.GetAttribute("href")
If href.ToUpper.Contains(".wmv".ToUpper) Then
MediaPlayer.Show()
MediaPlayer.BringToFront()
MediaPlayer.AxWindowsMediaPlayer1.URL = href
ElseIf href.ToUpper.Contains(".exe".ToUpper) Then
Me.AllowNavigation = False
e.Cancel = True
Form1.DownloadTimer.Start()
Else
Me.Navigate(href)
End If
System.Threading.Thread.Sleep(500)
Me.AllowNavigation = True
End Sub
But it does not work
Has anyone got any ideas?
#8
Re: Editing the webbrowser control
Posted 05 June 2009 - 12:51 AM
Has anyone got any ideas?
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|