CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2007
    Posts
    56

    Attach object to DataGridView rows

    .NET 3.5

    I need to attach an object to each row in a DataGridView. I thought it should be any property for doing it but I cant find it. How is it done?
    (Btw in this case Im not connecting to any DataSet.)
    Last edited by MattTC; April 17th, 2009 at 03:59 AM.

  2. #2
    Join Date
    Jul 2008
    Posts
    70

    Re: Attach object to DataGridView rows

    You should be able to extend the row with your own custom data type

  3. #3
    Join Date
    Feb 2007
    Posts
    56

    Re: Attach object to DataGridView rows

    You mean creating a custom class that derives from the DataGridViewRow?

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

    Re: Attach object to DataGridView rows

    Quote Originally Posted by MattTC View Post
    .NET 3.5

    I need to attach an object to each row in a DataGridView. I thought it should be any property for doing it but I cant find it. How is it done?
    (Btw in this case Im not connecting to any DataSet.)
    If you need to add smething to a dgvrow you ned to create a dgv Column
    In this column cell you cann add your object.
    If you are using the ToString() property of your object and the class you are adding overrides its ToString() method then you will be able to see your class and having a meaningfull name of the instance in each row.
    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

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