Hello.
How are you all doing?
I have finally left vb6 behind and moved to vb8
But i'm having a problem, I dont know on how to retrieve the data of all the input fields on my temp webpage: link.
Could anyone help me out?
Friendly Regards
Me
Printable View
Hello.
How are you all doing?
I have finally left vb6 behind and moved to vb8
But i'm having a problem, I dont know on how to retrieve the data of all the input fields on my temp webpage: link.
Could anyone help me out?
Friendly Regards
Me
Is this ASP.NET or WinForms?
Just in case it is ASP.NET, you would get the values of all controls on postback in your server-side code.
The page is html, thats what i will always be seeing.
Hello.
My program is a WinForms.
Inside my program i have a web browsercontroll
Regards Me
You can loop thru the elements in the WebBrowser.Document and if you find that it is an element of type INPUT, get its value (or whatever you want).
e.g.
(not tested code)
vb.net Code:
For Each element As HtmlElement In WebBrowser1.Document.Body.All If element.TagName = "input" Then 'you can access the element here 'e.g. we show its value in a messagebox for example MessageBox.Show(element.GetAttribute("value")) End If Next
From what I see from the source of that page, this is the line that shows that number:
This (or any of its parents) do not have an ID tag. So there is no sure way to identify this element. But looking at the whole document I find that this is the only element using the class="HeaderLabel2" style. So what we can do is get all the <td> tags and then check each one of them if its class is "HeaderLabel2".Code:<td class="HeaderLabel2" valign="center" width="45%" align="right">Borg Fred (750416551)</td>
So you can try something like this to get it:
(not tested code)
vb.net Code:
For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("td") If element.GetAttribute("class") = "HeaderLabel2" Then MessageBox.Show(element.InnerText) Exit For End If Next
If you are the developer of this page or can get the source altered, I would recommend putting an ID tag with whatever elements you need to reference to. This way you do not need to loop thru all the elements or use any other non-reliable method to reference it.
e.g. If that element had an ID tag, we could have simply done it in one line and with much more confidence:
vb.net Code:
MessageBox.Show(WebBrowser1.Document.GetElementById("Element_Id_Here").InnerText)
or maybe the neater way:
vb.net Code:
Dim element As HtmlElement = WebBrowser1.Document.GetElementById("Element_Id_Here") MessageBox.Show(element.InnerText)
Hello.
I have perfect implemented the readout of the web page in my program.
What i did was:: I cached it all in a public array(the stuff I wanted),
That way i can access it everywhere when needed and also stored it in my database for later usage.
Dear Pradeep: i do not have access to the source code.Quote:
Pradeep1210: If you are the developer of this page or can get the source altered, I would recommend putting an ID tag with whatever elements you need to reference to. This way you do not need to loop thru all the elements or use any other non-reliable method to reference it.
But I have solved the readout of the client number: 750416551
What I'm creating is a new version of a very old outdated program
The problem is i work as a subcontractor for a company, that company use a browser system to control everything.
For example: When i arrive @ a client i have to click the 'Start order' Button.
And this is where my next question comes in.
Is it possible to do that automatically for me, like if i click a command button i click the start order button?
The page I have link't is saved from the webbrowser during work ;)
Its 1 of the many i have to decode
And thanks for are the help so far, this is why I always come to this forum when i need aide!
bump
vb.net Code:
WebBrowser1.Document.GetElementById("btStartOrder").click 'or WebBrowser1.Document.Forms("formname").InvokeMember("btStartOrder")
Google around for "Document Object Model" and "DOM Scripting". I'm sure you would find many good links.
Also have a look at this wikipedia article:
http://en.wikipedia.org/wiki/Document_Object_Model