load data from combobox

  • VB6

Es gibt 7 Antworten in diesem Thema. Der letzte Beitrag () ist von Perseus.

    load data from combobox

    Hi,
    I have combobox on web page(IE). I'd like save data items of combobox ("red (free)", "green(full)",...) into array of string in my program.
    Could you help me please.

    This is example web page:

    <select name="target">
    <option value="~" selected>-color-</option>
    <option value="Red" >Red (free)</option>
    <option value="Green" >Green (full)</option>
    <option value="Yellow" >Yellow(free)</option>
    <option value="Black" >Black (full)</option>
    <option value="White" >White (free)</option>
    </select>

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Marcus Gräfe“ ()

    url of actual web page

    Hi,
    I opened web page(by code). I click on variable links(by mouse). And now I'd like get actual link to the string variable in code.
    Could you help me whit this, please.

    I use this code:
    ...
    Set ie = CreateObject("InternetExplorer.Application")
    ie.navigate adresa

    Do While ie.READYSTATE <> 4
    DoEvents
    Loop
    ...
    What are form and index by forms?

    Use ie.document.form(0)... for the 1st form without a name or if the form have a name use ie.document.form("formname")...
    Are elements on page input,button etc?

    Yes, but you just need "elements" if the input-fields and buttons are without a name. If you know the names you can use ie.document.form(...).elementname.value<p>
    Example for the "select/option" elements:
    msgBox ie.Document.All("comboboxname").Options(index).Text / Value
    Gruß, Agent Smith 8-)

    activeFlags = (lazy OR weary)

    Lemgo-Verschwörung | Mathematics | VB-Paradise in blau

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Agent“ ()

    I haven't a form. I have only main function and doh function.

    Sub Main()

    Dim n

    For n = 1 To 1
    Call doh
    Next

    End Sub

    Sub doh()

    Dim ie As Object
    Dim adresa

    adresa = "D:\a\...examle_web_page_listed_above.html"
    Set ie = CreateObject("InternetExplorer.Application")
    ie.Navigate adresa

    Do While ie.READYSTATE <> 4
    DoEvents
    Loop

    ie.Visible = True

    Dim myArray(10) As Integer

    myArray(0) = ie.document.Forms(0).elements(0).Value ' ?

    Set ie = Nothing

    End Sub

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Perseus“ ()

    I haven't a form. I have only main function and doh function.

    No vb form, i mean the forms in a website html document.
    myArray(0) = ie.document.Forms(0).elements(0).Value ' ?

    You should use a for-loop like this:

    Quellcode

    1. For i = 0 To ie.Document.All("combobox").length - 1
    2. myArray(i) = ie.Document.All("combobox").Options(i).Text
    3. Next i

    "combobox" is the name of the combobox in the html document. You should also use a dynamic array and not a static array with 10 elements... see commands "redim preserve" in this forum
    Gruß, Agent Smith 8-)

    activeFlags = (lazy OR weary)

    Lemgo-Verschwörung | Mathematics | VB-Paradise in blau