|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Input data to websiteHi,
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 ? 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. Show quoteHide quote "WebNewsReader" <n***@avaiable.com> wrote in message news:uAFj3UeHHHA.4992@TK2MSFTNGP04.phx.gbl... > 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 ? 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... 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 Show quoteHide quote "WebNewsReader" <n***@avaiable.com> wrote in message news:eMtuqctHHHA.1188@TK2MSFTNGP06.phx.gbl... > 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...
Error calling unmanaged DLL
11th hour failure to trigger click event for object in hash table Bring in a form from another solution/project Re: destroying/releasing objects from memory? Problems with settings. Connected App (VB2005) Help... Nullable types and datareader... Creating databases from VB2005 Express or VB2005 Form Upload Test Utility? Trying to write a COM accessible DLL |
|||||||||||||||||||||||