vb dictionary对象中的对照
vb dictionary对象中的对比
本帖最后由 dzy1232012 于 2012-11-15 15:00:07 编辑 假设有两个字典象
a 的值是5,6,7,8,9
b的值是1,2,3,4,5,6,8
两个键相同
我想实现比较 a的值在b里面就msgbox "a" 不在就msgbox "b"如何实现
------最佳解决方案--------------------
For ictr= 0 to Dicta.count-1
if Dictb.Exists(Dicta.items(ictr)) then
msgbox "a"
else
msgbox "b"
end if
next ictr
------其他解决方案--------------------
我也用的是这个方法可以显示不对
------其他解决方案--------------------
有点区别了
我用的是
for i=0 to dicb.count-1
if dica.exists(dicb.items(i)) then
msgbox "A"
else
msgbox "b"
endif
next i
本帖最后由 dzy1232012 于 2012-11-15 15:00:07 编辑 假设有两个字典象
a 的值是5,6,7,8,9
b的值是1,2,3,4,5,6,8
两个键相同
我想实现比较 a的值在b里面就msgbox "a" 不在就msgbox "b"如何实现
------最佳解决方案--------------------
For ictr= 0 to Dicta.count-1
if Dictb.Exists(Dicta.items(ictr)) then
msgbox "a"
else
msgbox "b"
end if
next ictr
------其他解决方案--------------------
我也用的是这个方法可以显示不对
------其他解决方案--------------------
有点区别了
我用的是
for i=0 to dicb.count-1
if dica.exists(dicb.items(i)) then
msgbox "A"
else
msgbox "b"
endif
next i