CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2000
    Location
    Miami, Florida
    Posts
    142

    Adding entry to HTML Listbox

    Hi

    I have a webbrowser control, that among things within the HTML page, contains a listbox.

    I need to be able to add entries to the listbox directly from VB. The user can add their own entries via the HTML buttons I have provided, but how can I interface the HTML to (dynamically) add entries to an otherwise empty list???

    Many thanks

  2. #2
    Join Date
    Jan 2001
    Posts
    22
    Add a tag to the html like <insert the tags here>
    The web browser will ig nore it.

    At the time of viewing, use a replace function to
    change the <insert the tags here>, tag
    with html code the user had specified.

    just one way.

  3. #3
    Join Date
    Dec 2000
    Location
    Miami, Florida
    Posts
    142

    Thank you - but...

    The HTML file would be constructed by the app previously, and dynamically.

    It is then necessery to populate an empty list box at a later stage, so by the nature of this design, the list can't be created at 'creation of HTML' time, and has to be, as said above, dynamically 'added'. Easy to achieve in Javascript, but from VB.. a bit tougher.

    I basically have to find the correct 'path' to the HTML object, so something along these lines:

    mform.qform.Document.query.elements(9).Options.Add("text", 2)

  4. #4
    Join Date
    Dec 2000
    Location
    Miami, Florida
    Posts
    142

    Solved...

    Basically I create a javascript function which is coded in the HTML page.. then VB can call the script:

    Call mainform.qform.Document.parentwindow.execScript("addentry(1,'test')", "JavaScript")


    I just never realised you could call scripts ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured