Input data to website

W

WebNewsReader

Hi,

I'm using a webbrowser control to access a page.
I would like to auto set some fields using VB 2005 express
The field has the propery name="quantity"
Can it be done ?
 
S

sstory

You should be able to use the Document Object Model for Internet Explorer.
You are actaully using Internet Explorer if you use that control.

I don't know the specifics without researching it.

Obviously if the page accepts query params you could call the page with
those set, assuming you understand them, or its your site, and you know it
won't change.
 
W

WebNewsReader

This is what I got until now ;)

Found this code
____________________________________________
Dim wWeb As HtmlElement
wWeb = WebBrowser1.Document.GetElementById("login")
wWeb.SetAttribute("value", "test")
____________________________________________

in html code is this:
____________________________________________
<input name="login">
____________________________________________

But I keep on getting this error
____________________________________________

System.NullReferenceException was unhandled
Message="A referência de objecto não foi definida como uma instância de um
objecto."
____________________________________________

Need help as I am getting nuts around this...
 
S

sstory

This means you are trying to operate on an object that is nothing.

You don't know that wWeb every gets a value and then you try to
SetAttribute. If wWeb is "nothing" then you will get this error.

Try

if wWeb is nothing then
'if this is ASP.net, do this to report the error to you
response.write("wweb is unexpectedly nothing")
response.end
'otherwise do use
msgbox("wweb is unexpectedly nothing")
else
wWeb.SetAttribute("value","test")
end if

run this and it should tell you what going on . If wWeb is nothing then you
are looking for a value that it doesn't find I guess.




end if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top