首先你的list属性里边的multisele必须为.T.
不知道你的数据源是不是数组,我的是先从表里删除,然后再刷新数据源,list的数据源是数组,你可以参考一下:
IF TYPE("deleteA")="U"
PUBLIC deleteA
endif
deleteA=''
IF MESSAGEBOX("所选定数据将从数据库中删除,是否继续?",4+64,"提示")=6
FOR i=1 TO ThisForm.list1.ListCount
IF thisform.list1.selected(i)
SET DEFAULT TO &prgpath
&指定表的路径
IF !USED("表名.dbf")
USE 表名 EXCLUSIVE
ENDIF
deleteA=deleteA+" "+ALLTRIM(thisform.list1.ListItem(i))+" "
DELETE FOR 字段名=ALLTRIM(thisform.list1.ListItem(i))
PACK
endif
ENDFOR
endif
thisform.list1.RowSourceType=1
&&重新生成list1
thisform.list1.RowSource=""
FOR i=1 TO ThisForm.list1.ListCount
thisform.list1.RemoveItem(i)
ENDFOR
set default to "&prgpath"
thisform.list1.RowSourceType=5
IF TYPE("lista")='U'
PUBLIC lista
ENDIF
IF file("表名.dbf")
IF !USED("表名.dbf")
USE 表名 EXCLUSIVE
ENDIF
lista=0
GO top
SCAN
IF 字段名!=" "
lista=1
clear events
endif
ENDSCAN
if lista=1
select dist 字段名 from 表名 into array t1 WHERE 字段名!=" "
IF TYPE("tt1")="U" or alen(tt1)#ALEN(t1)
PUBLIC tt1(ALEN(t1))
endif
FOR i=1 TO ALEN(t1)
tt1(i)=t1(i)
endfor
thisform.list1.RowSource="tt1"
ENDIF
endif