Visual Studio 2003, Watch Window, ListView, SubItems

J

jeffbernstein

Greetings.

I have a ListView control loaded with several items and I'd like to
explore the collection via the Watch Window in Visual Studio .NET 2003.
My textbook was written for the previous version of Visual Studio and
it looks like you're able to explore the collection via that Watch
Window but I'm unable to do that in 2003. Am I missing something or has
this feature gone away?

I've found a few posts from people complaining about this "feature" but
no follow up. Can anyone shed any light on this?

By the way, when I expand the SubItems item, next to Item it says
<cannot view indexed property>.

Thanks,
Jeff
 
S

Steven Nagy

By the way, when I expand the SubItems item, next to Item it says
So it sounds like you ARE watching the ListView, but can't get to the
sub items, correct?

When you get this error, you can use the Count or Length properties to
see how many items are in the collection, and then reference them
directly.
Ie. MyListView.Items(0).SubItems(1)
You can type this directly into the Watch window.
Also you could always write out the object information to a log file or
console.
This works in VS2003

In the case of Datarows, you can just use the ItemArray property
instead of the default indexer to view all the items at once.

Worse case you could always inherit from whatever object you are having
trouble viewing and expose your own ItemArray property.

Hope this helps,
SN
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top