views:

64

answers:

1

In the past, I used the code below to fill out a form field using the webbrowser control in VB.Net. The page I am working with doesn't have name field for the inputbox, so my code doesn't work. How would I fill out the input box defined at the bottom of this post in bold?

Dim iPage As HtmlDocument
iPage = wb1.Document
iPage.All.Item("case_num").InnerText() = caseNum
iPage.All.Item("button1").InvokeMember("click")

**<input type="text" id="tbSymbolLookupMain" mode="mixed" autocomplete="off" defaulttxt="Enter Name or Symbol(s)" value="Enter Name or Symbol(s)" class="SymbolLookup  fhHandleFocus fhDefault">**
A: 

Is input in your question actual data you work with? You can try to use HtmlDocument.GetElementById to find it by id. But unless I'm mistaken what you do should already work as MSDN states Item("some name") on HtmlElementCollection uses "some name" to match both by Id and Name. So you might use your usual way but provide id instead of name

iPhone beginner
I'm not sure I understand your question?
ajl
is "<input type="text" **id="tbSymbolLookupMain"** mode="mixed" autocomplete="off" defaulttxt="Enter Name or Symbol(s)" value="Enter Name or Symbol(s)" class="SymbolLookup fhHandleFocus fhDefault">" the date you have your issue with? Then try your usual way as iPage.All.Item(**"tbSymbolLookupMain"**)
iPhone beginner
That's the one, but it doesn't seem to work. This pops an error?? iDoc.All.Item("tbSymbolLookupMain").InnerText() = symbol
ajl
Could you please provide error details? Also does iDoc.All.Item("tbSymbolLookupMain") return anything at all? Can you find any other HTML-element? It is stupid guess but didn't you make a typo in ID?
iPhone beginner
Wait, which part do you think I made a typo?
ajl
The place where there might by typo is ID name i.e. **tbSymbolLookupMain**. However this was just guess. The really interesting questions in my opinion are: "Does iDoc.All.Item("tbSymbolLookupMain") return anything at all (or Nothing)?" and "Can you find any other HTML-element?". It might be that the issue with iDoc for example.
iPhone beginner