Thanks Michael, this works now with thisform.hscntcode .hslstprint.additem(.hstxtcode.value) .hslstprint.addlistitem(.hstxtdesc.value,thisform.hscntcode.hslstprint.newit emid ,2) .hslstprint.addlistitem(transform(.hstxtamount.value),thisform.hscntcode.hsl stprint.newitemid ,3) endwith
James E Harvey Hanover Shoe Farms, Inc. M.I.S./Corresponding Officer Off: 717-637-8931 fax: 717-637-6766 email: [EMAIL PROTECTED] -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of MB Software Solutions Sent: Thursday, August 02, 2007 12:08 PM To: profox@leafe.com Subject: Re: Add items to listbox problem James E Harvey wrote: > I'm trying to allow users to add date to a listbox on the fly. The data is > coming from textboxes on the form where the user enters data, and then > clicks an "Add" button. > > This code is in the method for the click. > > with thisform.hscntcode > .hslstprint.additem(.hstxtcode.value) > .hslstprint.list[1,2] = .hstxtdesc.value > .hslstprint.list[1,3] = transform(.hstxtamount.value) > Endwith > > > It works for the first item, but not subsequent items as the > ".hslstprint.list[1,2]" is problematic. > > Can't figure how to increment the "1" after .list which is what positions > the value in the listbox. > > If I understand your question correctly, you need to check out the NewItemID property. Here's a snippet of code that I use sometimes to populate dropdowns (which should work as well with a listbox iirc): SELECT vluEstimators SCAN this.AddItem(vluEstimators.cFullName) this.AddListItem(ALLTRIM(STR(vluEstimators.iid)),this.NewItemId,2) ENDSCAN -- Michael J. Babcock, MCP MB Software Solutions, LLC http://mbsoftwaresolutions.com http://fabmate.com "Work smarter, not harder, with MBSS custom software solutions!" [excessive quoting removed by server] _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.