Map GetValueAt throws error

tmighty

Member
Licensed User
Longtime User
Hello!

I am doing the following:

For i = 0 To 11

Dim sCaption As String
sCaption="Some caption"

If i<2 Then
Dim nThisMap As Map
nThisMap = ListOfMaps.Get (i)
sCaption = nThisMap.GetValueAt(1)
End If

The IDE breaks in the line
sCaption = nThisMap.GetValueAt(1)

I am not sure what I am doing wrong.
When I hover the mouse over "nThisMap", I can see that it is correctly filled with values and keys. There are 5 values/keys, so trying to retrieve the value at position 1 should not fail.

Does anybody see where I went wrong?

Thank you.
 

tmighty

Member
Licensed User
Longtime User
Doh! It was not stopping because of an error. It was stopping because I set a breakpoint. What confused me was that I set a breakpoint in the end next line ("End If") to inspect the value of "sCaption", but this breakpoint did not break, so I thought the IDE stopped. I did not recognize that it was already at the next "i" in the For-Next loop.

To make it more clear and to reproduce the behaviour, do this:

If i<2 Then
Dim nThisMap As Map
nThisMap = ListOfMaps.Get (i)
sCaption = nThisMap.GetKeyAt(2)
End If

Set 2 breakspoints:
Breakpoint 1 at line "sCaption = nThisMap.GetKeyAt(2)"
Breakpoint 2 at line "End If"

Breakpoint 1 will be hit, but breakpoint 2 will not be hit although the breakpoint is present.
 
Last edited:
Upvote 0
Top