Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Please help trying to delete an item from list box
Message
From
10/05/2002 11:36:24
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00654221
Message ID:
00655095
Views:
52
>how can i trim all the values whichever appears in the list box.before i click delete.
>
>because all the values are coming from the view so the value actually in the view is "112 " with space but in the select query which is used for delete in it the values appearing"112" with no space so i assume that is the reason why it is not deleting.

The view also needs to be requeried, then. You also need to do a tableupdate() on the view after deleting, to propagate the changes into the table.

>**********Following is the code i am using*************
>THISFORM.mousepointer = 11
>local cListTable
>cListTable = "WorkpkgTask_View"
>select (cListTable)
>
>lCount = thisform.list1.listCount
>WAIT WINDOW "Scanning for records to delete" NOWAIT NOCLEAR
>
>FOR cnt = 1 TO lCount
>	IF INKEY() = 27
>		EXIT
>	ENDIF
>	IF thisform.list1.selectedId(cnt)
>		thisform.list1.selectedId(cnt) = .f.
>		SELECT (cListTable)
>		LOCATE FOR project_no = <b>trim(</b>thisform.list1.listItem(cnt,1)<b>)</b> AND Workpkg_no = <b>trim(</b>thisform.list1.listItem(cnt,2)<b>)</b>
* now check whether you found it or not. You may as well Assert found() here.
		if found()
>		DELETE
		lSuccess=tableupdate(0)
* check whether the record is deleted in the table as well
		else
* now scratch your head and look at the values in the Locate line in the debugger
* see why didn't they match. Browse your view and try to find them
		endif
>	ENDIF
>ENDFOR
requery(cListTable)
>WAIT CLEAR
Another thing, check the view and make sure it has a ...Where !deleted() in its definition.

That's all I could think of.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform