CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Dec 2008
    Location
    Step Into(F11)
    Posts
    465

    [RESOLVED] Watching collection data using immediate window

    i have made one collection suppliers.and collection to collect all supplier data cSuppliers.i want to
    see collection data using immediate window.Can anybody tell me .How should i see collection value using immediate window.any help would be Greatly appreciated.when i type ?m_cEmployees.Item(1) in a immediate window i got error
    object does not support this property of method.Kindly find the attachment also.any help would be greatly appreciated.

    [code=vb]
    ?m_cEmployees.Item(1)

    [/code]

  2. #2
    Join Date
    Apr 2009
    Posts
    394

    Re: Watching collection data using immediate window

    Code:
    Option Explicit
    
    Private Sub Form_Load()
    Dim C As New Collection
    C.Add "Test"
    End Sub
    Code:
    ?c(1)
    Test
    ?c.Item(1)
    Test
    Which tells me that you have not initialized your collection.


    Good Luck

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Watching collection data using immediate window

    Click MANAGE ATTACHMENTS on the bottom of the REPLY page. Browse for your ZIP file, click UPLOAD, then save the message.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  4. #4
    Join Date
    Apr 2009
    Posts
    394

    Re: Watching collection data using immediate window

    Go Advanced

  5. #5
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Watching collection data using immediate window

    To understand more of your collection:
    What type of items do you add to it? Is it simple strings or are they objects of more complex nature?

  6. #6
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Watching collection data using immediate window

    You can't see the whole value of all the members of your collection. This isn't VB.Net, which does have a .ToString method which will return collection data
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  7. #7
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Watching collection data using immediate window

    Quote Originally Posted by dglienna View Post
    You can't see the whole value of all the members of your collection. This isn't VB.Net, which does have a .ToString method which will return collection data
    Forget all this discussion. I have already shown him picture by picture how to watch values in a collection how to build up a collection how to read data and all that. But Instead of doing what I told him he wants things which are not usual in VB. For example he wants to see the pointers to the heap and he adresses the items with the internal structure data instead with the real key...
    Firoz as already told 100 times or more ( really ) Use
    m_cemployees and not m_cemployees.Item(3)
    Your Items have Keys like E1, E2,... E155 and the collection class Item property waits for a string which starts with 'E'
    And if you want to see the items look into the debugger one item after the other within your collection class
    Here in this inner collection ( mCol as Collection ) the items are numbered from one to n logically.
    But simple open the items with the + sign and you can watch every single item. Look at the screenshots I did for you and DUPLICATE whats going on.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  8. #8
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Watching collection data using immediate window

    Quote Originally Posted by dglienna View Post
    You can't see the whole value of all the members of your collection. This isn't VB.Net, which does have a .ToString method which will return collection data
    Can't you use the Item property of the collection ¿

    ToString is only a Conversion function, nothing special really...

    EDIT: Didn't see your post Johann, great post as usual

  9. #9
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Watching collection data using immediate window

    Here we have a similar collection ( suppliers instead of employees but both collections are basically out of the same program) where he is also bothering me, he cannot look at the items. What he doesn't understand is, that in the collection the items are named item1 item2 ... but as we see in the example the items Key is not '1' or '2' its 'S1', 'S2' in that case.
    He knows how to look at that items in the way I'm showing in my picture as I have done a picture by picture lesson for him explaining all that stuff which has needed me some hours only for that.

    I dont understand any reason, why it is not enough for him to look each needed item in the collection. The main reason he doesn't understand is why he cannot simple watch m_Suppliers.Item(1) when the debuger shows an Item1 and he needs instead of that
    a) look into the whole collection and open the needed item or
    b) debugging m_Suppliers.Item("S1") respectivly in his actual request m_Employees.Item("E1")

    Its such simple, there is no other difficulty in that.
    Attached Images Attached Images  
    Last edited by JonnyPoet; July 17th, 2009 at 09:34 AM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  10. #10
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Watching collection data using immediate window

    Quote Originally Posted by HanneSThEGreaT View Post
    Can't you use the Item property of the collection ¿

    ToString is only a Conversion function, nothing special really...

    EDIT: Didn't see your post Johann, great post as usual
    You can see ONE item in a debug.print statement, but not the whole list, as you can in Net. By .ToString, I meant defining your own string (which could include a loop to show all items)
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  11. #11
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Watching collection data using immediate window

    I don't understand what you mean David Mind showing an example of what you mean, because I don't get what you are trying to illustrate with ToString.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured