WebBrowser problem with Late Bind names

There is a problem with using late WebBrowser binding calls related to creating object / property names.

For instance:

WebBrowser1.Document.DomDocument.Forms.Myform.mycontrol.Value = "test"

will happen with more than one instance of a webbrowser control

what actually happens is that mycontrol object will become mycontrol and the compiled vb.net application will fail

No member found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND)) in Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet (Object o, Type objType, String name, Object [] args, String [] paramnames, Boolean [] CopyBisBicicasasas. CompilerServices.NewLateBinding.LateGet (object instance, Type Type, String MemberName, Object [] Arguments, String [] Arguments, Type [] TypeArguments, Boolean [] CopyBack) in Execute () in C: \ Projects \ WebBrowser \ SampleCall.vb : line 16

Are there any solutions for this problem?

The same code will work with a vb6 application with multiple WebBrowser controls

Edit: this code is complemented by: Option Strict Off

+5
source share
2 answers

@bugtussle

:

WebBrowser1.Document.Forms("Myform").Children("mycontrol").InnerText = "test"
WebBrowser1.Document.DomDocument.Forms("Myform").all("mycontrol").Value = "test"
WebBrowser1.Document.DomDocument.Forms.Myform.all.mycontrol.Value = "test"

,

Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet , , BindingFlags.IgnoreCase binder.InvokeMember.

, COM, - , COM- . , "MyControl", , "mycontrol". , - InvokeMember .

+2

-:
WebBrowser1.Document.Forms("Myform").children("mycontrol").Value = "test"

0

All Articles