Question Auto fill [ActiveX control] form using Webbrowser control


New member
Nov 6, 2014
Programming Experience
Hello, I'm a newbie to VB.NET Forums, nice to meet you all!

Recently, I am doing an interesting project on auto-fill web forms, then I come to some difficulties, hope that someone can give me some advices.

I already read some old posts about this topic, and learned the basic technique of auto-fill forms when

I created a form with "WebBrowser" in visual studio (, when the form loaded, it fires up a website(, there is a login form, my mission is to auto fill in the login name and password fields (captcha can be ignore)
I passed the "Card(Account) Number" with he following code
Dim frameDoc As HtmlDocument = WebBrowser1.Document.Window.Frames(0).Document
        Dim frameUser As HtmlElement = frameDoc.GetElementById("logonCardNum")
        frameUser.SetAttribute("value", "UserABC") ' write into the textbox

I believe that the password field is an ActiveX control, I can't do it like the "Card(Account) Number"
I can only did it with "Sendkeys", but I know it is not appropriate.

The password field is embedded:
<OBJECT onkeyup="getfocus1('KeyPart',  event);detectCapsLock('logonform','safeEdit1',500,300,400,'logontb');"  onfocus="detectCapsLock('logonform','safeEdit1',500,300,400,'logontb')"  onblur="closeCapTip('logonform','safeEdit1')" id=safeEdit1  codeBase="/icbc/newperbank/,0,0,13"  classid=CLSID:73E4740C-08EB-4133-896B-8D0A7C9EE3CD width=145  height=21><PARAM NAME="_cx" VALUE="3836"><PARAM NAME="_cy"  VALUE="556"></OBJECT>

Is there a proper way to pass value into the password field with it ID/name??

Thank you for any advice!!!

Latest posts

Top Bottom