我的天!如果要查我只能用两层循环找了!
dw_1.accepttext()
for ll_item = 1 to dw_1.rowcount() -1
ls_id1 = dw_1.object.id1[ll_item]
ls_id2 = dw_1.object.id2[ll_item]
for ll_find = ll_item + 1 to dw_1.rowcount()
if ls_id1 = dw_1.object.id1[ll_find ] and ls_id2 = dw_1.object.id2[ll_find ] then
dw_1.selectrow(0,false)
dw_1.selectrow(ll_item,true)
dw_1.selectrow(ll_find ,true)
dw_1.scrolltorow(ll_item)
return
end
next
next
不过这样效率奇低,如果你只是要保证修改后的数据窗口不含重复主健的话
在itemchanged时在accepttext()之前find一下你输入的值比较好吧!