dynamic listbox additions

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

Locked
User avatar
dpayer
Posts: 1394
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

dynamic listbox additions

Post by dpayer »

I had a project that required selection (from a listbox) with the option to add a new entry from the user.

Here is a code snippet used to solve it. I used the selection option "Other" at the bottom of the list and when it is selected you get an input box which adds the item. The listbox uses the item number as the variable result of a selection. Code is inserted in the "Selection Changed" area for the listbox. If Single item selection is used, it leaves the new item selected when done.

Code: Select all

ListBoxGetItem "InfoFrom" "[InfoFrom]" "[selectedfromitem]"
If "[selectedfromitem]" "=" "Other"
InputBox "AA information from" "Who contacted you about this Alert" "[InfoFrom2]"
    If "[infofrom2]" "<>" ""
    ListBoxChangeItem "InfoFrom" "[infofrom]" "[InfoFrom2]"
    ListBoxAddItem "InfoFrom" "0" "Other"
    Endif

Endif
David P.
David Payer
Des Moines, Iowa
USA
smokinbanger
Posts: 204
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Re: dynamic listbox additions

Post by smokinbanger »

Other is Other.

I've always used <Add New> as an option to add a new entry. Actually got the idea from Quickbooks over 10 years ago (2002 version).
Just Sayin'...
Locked