Advertisement
6_2008-2009 VB function enhancement #198240

Retrieve Values from Web Page (WebBrowser Control)

Allows you to retrieve values from fields (i.e. hidden fields) in a web page loaded using the WebBrowser control. Very simple function, but I've found it extremely useful. Please don't forget to leave a comment to let me know what you think! To call this function try this example: MyValue = GetWebValue(MyWebBrowser,"fieldname") Will return the value or nothing if not found.

AI

KI-Zusammenfassung: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Quellcode
original-source
Function GetWebValue(WebBrowser As WebBrowser, value As String)
 'Checking if a Frame Page is being displayed
 On Error GoTo EndStuff:
 Set LkpWeb = WebBrowser.Document
 If LkpWeb.Frames.Length > 0 Then
 'Cycle through the frames
 For i = 0 To LkpWeb.Frames.Length - 1
 Set Lkp = LkpWeb.Frames(i).Document.All
 On Error Resume Next
 GetWebValue = Lkp.Item(CStr(value)).value
 If Err.Number = 0 Then
 Exit For
 End If
 DoEvents
 Next
 Else
 Set LkpWeb = WebBrowser.Document.All
 On Error Resume Next
 GetWebValue = LkpWeb.Item(CStr(value)).value
 End If
EndStuff:
End Function
Originalkommentare (3)
Wiederhergestellt von der Wayback Machine