Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing items in a listbox with a SQL source
Message
From
02/10/2003 03:50:23
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00832474
Message ID:
00834121
Views:
25
>>>>>Hi all,
>>>>>
>>>>>I'm building a work order form that has a listbox on a pageframe that is populated with a SQL statement so that the items related to that order are the items in the list box. The user needs to be able to remove items from the order. I'm having problems getting this to work.
>< snip >
>>>Using the code you suggest, am I still limited to the total number of characters in the rowsource property? It seems to be 255 characters using the property page.
>>
>>Matthew,
>>Notice that in sample code it might already be over 255 (I didn't count:). The 255 limit is for literal strings. Otherwise a string variable can hold up to 16Mb. ie:
>>
>>myVar = "assume this is over 255..." && Illegal
>>myVar = "this is less than or equal to 255..."+;
>>"this is less than or equal to 255..."+;
>>"this is less than or equal to 255..." && Legal
>>
>>While setting properties in PEM sheet you're limited to 255. But if you do that in code as in the above sample limit doesn't apply.
>>
>>Also notice that while we use only the first 4 columns in listbox display, cursor has more columns than that. Actually even if your list would show only 1 column you might have 255 columns in its RowSource. That's you might have as many more columns that you need to store info about (ie: cust_id, order_amt, to_name ...)
>>
>>If you look closely a row in SQL cursor has a one-to-one relation to list listindex. That's Listindex = 1 and rec #1, 2 = rec #2 and so on. IOW with an SQL rowsourcetype you could think of listbox sort of grid.
>>
>>Therefore in your SQL have as many columns as you want to store enough info about what to delete. If lstBox.selected(5) = .t. than it means record 5 in your SQL cursor (crsOITems in sample) is selected. Directly use alias.field to access necessary column info. ie: crsOITems.order_id.
>>Notice that listbox is only used to check if Selected(nRecno). We don't use list(nRow,nCol) or there is no bound column like thing to check the value. Directly using crsOITems for things like that.
>>Cetin
>
>You are the master of explanations. Thank you for the enlightenment. Sorry to not have gotten your reply sooner, things break and I have to take off the developer cap and become the sysadmin. I get back to programmerland and think "What was I thinking about last week?" Where in Turkey is Izmir? I spent some time in Iran in the mid seventies and really fell in love with the area.

Izmir is located in the middle vertically on west coast of Turkey ( to the south from Istanbul and to the east from Athens ). IF you happen to check from expediamaps enter 'Izmir,izmir,Turkey'.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform