Setting HTML Text Element value
- by Gpx
Hi,
in my C# WPF prog i´am trying to set a value of a HTML Text Element which is defined like:
<input name="tbBName" type="text" id="tbBName" tabindex="1" />
What i found about it and tried is:
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)webBrowser1.Document;
mshtml.HTMLInputTextElement tbName = (mshtml.HTMLInputTextElement)doc.getElementsByName("tbBName");
tbName.value = "Test";
But i got the exception:
Unable to cast COM object of type 'System.__ComObject' to interface type 'mshtml.HTMLInputTextElement'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{3050F520-98B5-11CF-BB82-00AA00BDCE0B}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
I know what it says but i dont know which object i can use to access the Texbox.
Thanks for any answers.