Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Put data in a list box into a table
Message
 
 
To
18/04/2007 21:56:07
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01217585
Message ID:
01217586
Views:
6
>I have a form with with a mover control. I have it working so that I can move data from source to selected side of the mover. I know how many items I selected. It displays the contents of two fields. An account number and a description. I need to put the selected contents into a table in the following steps if something is selected
>1. delete existing data in table, I assume I can do this with the commands
>
>IF USED('TABLE')
>   USE IN TABLE
>ENDIF
>USE TABLE IN O EXCLUSIVE
>SELECT TABLE
>GOTO TOP IN TABLE
>DELETE ALL
>PACK
>
>is this correct?
>

Using table exclusive could only be done in nobody else uses the table, keep this in mind. And also you just use ZAP command to empty the table.

>What I am not sure how to do is get the items in the selected list an put the them in TABLE. To put items in to the TABLE I assume if I could use the commands
>
>GOTO BOTTOM IN TABLE
>APPEND BLANK
>REPLACE accountno WITH lcaccount , description WITH lcdesctiption
>
>My problem is how to go through the selected items to find lcaccount and lcdescription.
>
>Any help appreciated.

What is your list rowsource type?

Anyway, you may try this:
with thisform.lstSelectedItems
for lnI = 1 to .ListCount
    if .selected(m.lnI) = .t.
      insert into Table (field1, field2) values (.List[1],.List[2])
    endif
next
endwith
This is from the top of my head and not tested. You may need to tweak the syntax a bit to get it right.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform