Input data to website

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • WebNewsReader

    #1

    Input data to website

    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 ?
  • sstory

    #2
    Re: Input data to website

    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.

    "WebNewsRea der" <none@avaiable. comwrote in message
    news:uAFj3UeHHH A.4992@TK2MSFTN GP04.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 ?

    Comment

    • WebNewsReader

      #3
      Re: Input data to website

      This is what I got until now ;)

      Found this code
      _______________ _______________ ______________
      Dim wWeb As HtmlElement
      wWeb = WebBrowser1.Doc ument.GetElemen tById("login")
      wWeb.SetAttribu te("value", "test")
      _______________ _______________ ______________

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

      But I keep on getting this error
      _______________ _______________ ______________

      System.NullRefe renceException 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...

      Comment

      • sstory

        #4
        Re: Input data to website

        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.SetAttribu te("value","tes t")
        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
        "WebNewsRea der" <none@avaiable. comwrote in message
        news:eMtuqctHHH A.1188@TK2MSFTN GP06.phx.gbl...
        This is what I got until now ;)
        >
        Found this code
        _______________ _______________ ______________
        Dim wWeb As HtmlElement
        wWeb = WebBrowser1.Doc ument.GetElemen tById("login")
        wWeb.SetAttribu te("value", "test")
        _______________ _______________ ______________
        >
        in html code is this:
        _______________ _______________ ______________
        <input name="login">
        _______________ _______________ ______________
        >
        But I keep on getting this error
        _______________ _______________ ______________
        >
        System.NullRefe renceException 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...

        Comment

        Working...