/ Forums / Advansys Formativ / Creating Solutions with Formativ / Formativ 2.0 Visual Forms Controls

  • Creator
    Topic
  • #4091
    Anonymous

    I am unable to read or write to the TabListBoxControl.Selected property when using visual forms in my applet.

    Even when I try to output the selected list item using a message box

    (ie. MsgBox “Get selected list item: ” & newList.Selected)

    the applet seems to skip this statement and then finishes executing without any problems.

    If I create a listbox control using code-dialogs instead, it works just fine.

    Could you please verify that this property works with Visual Forms? Could you please provide a sample on how to properly read/write to the items in a listbox just in case I am missing something?

    Please note, I have been able to access the properties for other controls in my visual form such as checkboxes.

  • Author
    Replies
  • #7071
    Anonymous

    Correction: when the applet gets to the “…newList.Selected” statement, it skips everything else in the current Sub and exits the Sub to return to Main.
    The applet then continues processing the script from there.

    #7070
    Support 1a
    Participant

    Thanks for the question. Could you please confirm the full control name you are using? (In the form designer, select the appropriate tab on the component pallete and hold the mouse over the component to see it’s name).

    It sounds like an exception is being raised when you try to access the property, but it is being suppressed by an ‘on error resume next’ or similar call. Try turning off any exception handling you may have implemented to see if an error message appears – it’s details may be a clue.

    Once you confirm the name of the component I’ll check its properties to confirm your usage is correct.

    Advansys Support

    #7068
    Anonymous

    The exception I got was:

    “Wrong number of arguments or invalid property assignment…”

    The control name I get when I hover over the control in forms designer is “ListBox”.

    #7069
    Support 1a
    Participant

    If you are using a standard ListBox (on the ‘Standard’ tab on the component palette), you need to use the ItemIndex property to obtain the index of the selected item. This is an integer value that returns -1 if no item is selected, or the index value of the selected item in the list.

    Given a ListBox control call ‘testListBox1’ on a form called ‘test’, you could display the selected selected item like this:

    if test.testListBox1.ItemIndex <> -1 then
       MsgBox test.testListBox1.Items(test.testListBox1.ItemIndex)
    end if

    You may also want to take a look at the updated Examples Pack, which contains three V2 solutions that use forms. The pack contains full source code, which may be helpful. Download it from: http://www.advansyscorp.com/download/examples_pack.exe.

    I hope this helps.

    Advansys Support

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.