开发者

Item is not being found in dictionary

I have this condition in an if statement:

If myDict.Exists(Cells(d.Row, d.Column - 1)) Then

At a particular step in the code (while stepping through it), the following code in the Immedi开发者_C百科ate window

MsgBox Cells(d.Row,d.Column-1)

gives me a value of "1/3/2011"

And at that very step,

MsgBox myDict.Item("1/3/2011")

returns a value too.

However, my if condition posted above does not equate to true. Why??

Do I need to be casting the result of Cells(d.Row,d.Column-1) as a certain type?


Cells returns an object. I usually just cast the cell into a range: ((XL.Range)Cells(d.Row,d.Column-1)).Value2.ToString(). Then compare the strings.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜