Source language: Translate to:

dynamic listbox additions

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

Moderator: Neosoft Support

dynamic listbox additions

Postby dpayer » Fri Feb 14, 2014 2:17 pm

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
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: dynamic listbox additions

Postby smokinbanger » Sat Mar 29, 2014 11:11 am

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'...
smokinbanger
 
Posts: 198
Joined: Mon Jan 16, 2012 9:53 am
Location: United States


Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 1 guest