Results 1 to 5 of 5

Thread: [2005] DataGridViewImageColumn Sort

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    180

    [2005] DataGridViewImageColumn Sort

    Hi,

    I have an image column in my DataGridView, in the cellformatting event I bind the image which can only be one of two tick.jpg or cross.jpg.

    Is there anyway I can sort on this column, I imagine the only way to do it would be on the filename?

    Any help appreciated

    Thanks

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] DataGridViewImageColumn Sort

    You can sort it any way you like. You would normally just check whether the Image object display 'Is' a particular Image.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    180

    Re: [2005] DataGridViewImageColumn Sort

    Okay, so do I set the sort mode to Programmatic for that column?

    I'm presuming then I need to catch a sort event, is that correct?

    Cheers

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] DataGridViewImageColumn Sort

    Have you read the documentation for the SortMode property?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    180

    Re: [2005] DataGridViewImageColumn Sort

    I have read this

    http://msdn2.microsoft.com/en-us/library/95scxcdy.aspx

    I know I need to handle the Sort method of the grid, but the next step is unclear, also in the notes section it says that the method will not work on unbound columns, which my imagecolumn is. It gets its value from a checkbox column which is hidden. So do I need to involve the hidden column somehow?

    Thanks

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