OnSetElementValueById
Interface AntViewDocument
Type: Event
Parameters: String Id Integer Error
Returns: None
Asynchronous result of setting the ElementValueById property
Id contains the Id of the element which was set, Id is case sensitive.
Error is 0 when the element is set, or 1 if the element identified by Id was not found.
Example in Visual Basic:
Option Explicit
Public WithEvents Document As AntviewAx.AntViewDocument
Private Sub Document_OnSetElementValueById(ByVal Id As String, ByVal Error As Long)
Dim Msg As String
Msg = "Setting Element '" & Id & "' error = " & CStr(Error)
Debug.Print (Msg)
InfoText.Text = InfoText.Text & Msg
End Sub
Private Sub FillFormButton_Click()
Document.ElementValueById("username") = "Mr. Smith"
Document.ElementValueById("password") = "supersecret"
InfoText.Text = "Next Click the Read Form button."
End Sub
Private Sub Form_Initialize()
Debug.Print "Form initialize"
Set Document = CreateObject("AntViewAx.AntViewDocument", "")
Document.BrowserDispatch EdgeWebBrowser.IDispatchPointer
EdgeWebBrowser.UnlockControl "ExampleCompany", "WI5PO2-2KSU3Q-HWFXFU-IUMU2V-QF8P2F"
EdgeWebBrowser.EventsUseHexadecimal = True
EdgeWebBrowser.NextFocusWindowHandleHwnd = GoButton.hwnd
EdgeWebBrowser.PreviousFocusWindowHandleHwnd = GetHtmlButton.hwnd
End Sub
Private Sub Form_Load()
EdgeWebBrowser.CreateWebView
Form_Resize
End Sub
Example:
AntView - The MS Edge WebView2 ActiveX control Date last changed: 04/16/2025