Advertisement
Java_Volume1 VB function enhancement #96763

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

Riepilogo AI: 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.

Codice sorgente
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
Commenti originali (3)
Recuperato da Wayback Machine