| 发表于:2007-06-09 23:58:143楼 得分:0 |
'两个列表的数据互相移动,可以设置全部移动 private sub movelistitem(lstsource as listbox, lstdest as listbox, byval ballitems as boolean) dim intidx as integer on error goto errmsg if ballitems = true then 'all items for intidx = 0 to lstsource.listcount - 1 call lstdest.additem(lstsource.list(intidx)) next intidx call lstsource.clear else 'selected items do while intidx < lstsource.listcount if lstsource.selected(intidx) = true then call lstdest.additem(lstsource.list(intidx)) call lstsource.removeitem(intidx) else intidx = intidx + 1 end if loop end if errexit: on error goto 0 exit sub errmsg: msgbox err.number & ": " & err.description resume errexit end sub | | |
|