How can I grab html source of a frame?
I can retrive main frame by WebBrowser1.DocumentText
but I want to retrive inner (child) frame...
WebBrowser1.Document.Window.Frames(0).DocumentText like thing doesn't exist...
See if this helps:
Private LinksTable As Hashtable
Private Sub WebBrowser1_DocumentCompleted(ByVal _
sender As Object, ByVal e As _
System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) _
Handles WebBrowser1.DocumentCompleted
GetLinksFromFrames()
End Sub
Private Sub GetLinksFromFrames()
LinksTable = New Hashtable()
Dim FrameUrl As String
If (Not WebBrowser1.Document Is Nothing) Then
With WebBrowser1.Document
Dim CurrentWindow As HtmlWindow = .Window
If (CurrentWindow.Frames.Count > 0) Then
For Each Frame As HtmlWindow In _
Frame.Document.Links
FrameUrl = Frame.Url.ToString()
Dim ThisFrameName As String = Frame.Name
Dim ThisFrameDocument As _
HtmlDocument = Frame.Document
Dim FrameLinksHash As New Hashtable()
LinksTable.Add(FrameUrl, FrameLinksHash)
For Each HrefElement As HtmlElement In _
Frame.Document.Links
FrameLinksHash.Add(HrefElement.GetAttribute _
("HREF"), "Url")
Next
Next
Else
Dim DocLinksHash As New Hashtable()
LinksTable.Add(.Url.ToString(), DocLinksHash)
For Each HrefElement As HtmlElement In .Links
DocLinksHash.Add(HrefElement.GetAttribute _
("HREF"), "Url")
Next
End If
End With
End If
End Sub
Gene