By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,285 Members | 1,269 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,285 IT Pros & Developers. It's quick & easy.

Option Strict ON and Dictionary obect

P: n/a
Using Option Strict On, how does one deal with the two lines I've marked
with comments?
Dim dict As Scripting.Dictionary
Dim i As Integer
Dim vnt As Object
dict = New Scripting.Dictionary
With dict
..CompareMode = Scripting.CompareMethod.BinaryCompare
..Add("a", "a")
..Add("A", "A")
vnt = .Items ' Problem line
End With
For i = 0 To UBound(vnt)
System.Diagnostics.Debug.WriteLine(VB6.TabLayout(i , vnt(i))) ' Perhaps,
problem line
Next i
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Howard,

Are you sure it is working without option strict.

I would assume something as
\\\
Dim dict As Scripting.Dictionary
Dim i As Integer
Dim vnt() As Object
dict = New Scripting.Dictionary
With dict
.CompareMode = Scripting.CompareMethod.BinaryCompare
.Add("a", "a")
.Add("A", "A")
vnt = Directcast(.Items,Object())
End With
For i = 0 To UBound(vnt)
System.Diagnostics.Debug.WriteLine(VB6.TabLayout(i ,
Directcast(vnt,Object())(i).ToString()))
Next i
///
I hope this helps,

Cor
Nov 21 '05 #2

P: n/a
Howard,

The last directcast is of course bs. the toString does it all.

Sorry

Cor
Nov 21 '05 #3

P: n/a
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Howard,

Are you sure it is working without option strict.
Yes.
I would assume something as


Thanx.

I had been awake for about 20 hours, groggier than usual (I just woke up
about 15 minutes ago), when I did the code and missed out that I had to use
Object() instead of Object. I was just casting to Object, not Object().
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.