CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Oct 2004
    Posts
    429

    Question Unable to display a List<MyClass> as one of the columns of my view

    I have the following classes:

    Code:
    public class Order
    {
    public string OrderName { get; set; }
    public List<Parts> PartsList { get; set; }
    }
    
    public class Parts
    {
    public string PartName { get; set; }
    public double PartQuantity { get; set; }
    }
    In my code I create a list of Order objects
    Code:
       List<Order> myOrders;
    I would like to display all of this to the user somehow, like using a stack panel of elements where the first is a TextBox to display OrderName and the second is a Datagrid to display the list of Parts?

    Honestly I am trying many different things (I have no requirements on what type of controls to use) but I can never get the PartsList to show correctly (either I get nothing OR I get "Collection" show to the user.

    The goal would be to see something like this:
    ....Order1....Part1 7
    ..................Part2 12
    ....Order2....Part1 100
    ..................Part2 1
    ..................Part3 58
    (dots are only there because spacing was off, should be spaces)

    Any help would be much appreciated.
    Thanks,
    Last edited by Shaitan00; January 20th, 2013 at 11:48 AM.

Tags for this Thread

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