Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql in listbox
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00410230
Message ID:
00410240
Views:
19
>Hello, I am having a problem with a listbox click event returning the value of what is in the clicked item. I have rowsource as a select statmentand rowsourcetype as sql. It always returns the first record though. :(

This is from my btcc_multilist.ItemList() code, which reconstructs a comma-delimited list of selected items:
********************************************************************
*  Description.......: BTCC_MultiList.BTC_ItemList: method to return a comma-delimited list of the selected items
*  Calling Samples...:
*  Parameter List....:
*  Created by........: MDA
*  Modified by.......: Nadya Nosonovsky 12/29/1999 04:20:21 PM
********************************************************************
* 11/26/99 NN added into this method an ability to populate btcselarray
* 12/14/99 NN added AllSelected property

* Returns a comma-delimited list of quoted codes corresponding to those selected.
* If none, returns the empty string.
local result, n, k, lnSel, lnLen

* check for empty array special case
if alen(this.btcvalarray) <= 1               && array is empty
     return ''                                   && null list result
endif

result = ''                                        && start with nothing
k=0
lnSel=0

with this

     lnLen=alen(.btcvalarray, 1)
* loop over the array, building list of selected codes
     for n = 1 to lnLen                    && cycle over rows
          if .Container1.List1.selected(m.n)               && this item is selected
               lnSel=lnSel+1 && increment count of selected items
               if k>=1 and ascan(.btcselarray, .btcvalarray[m.n, 2])>0 && This code already exists
* Do nothing
               else
                    result = m.result + iif(empty(m.result), '', ',') ;
                         + '"' + .btcvalarray[m.n, 2] + '"'     && tack on another code
                    k=k+1
                    dimension .btcselarray[k] && redim array
                    .btcselarray[m.k]= .btcvalarray[m.n,2]
               endif
          endif
     endfor

     .btccrit=m.result && store in a property

     if lnSel=lnLen and not .ExcludeFlag && All selected and don't need to be excluded
          .AllSelected=.t.
          m.result='' && empty criterion
     else
          .AllSelected=.f.
     endif
endwith
return m.result                                   && done - return list of selected codes
HTH
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform