dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: DataGridView Selected Row

Hybrid View

  1. #1
    Join Date
    Jun 2001
    Location
    Melbourne/Aus (C# .Net 4.0)
    Posts
    686

    DataGridView Selected Row

    I have a DataGridView control with the FullRowSelect SelectionMode, chosen (MultiSelect=False). So I select a row and all cells in that row go blue.

    I don't want the left-hand cell to go blue when I select a row, as this cell is colour-coded (background colour of cell is either red or green and I want the cell to stay that colour even when selected)

    Does anyone have any idea which event to handle to prevent this?

    Thanks
    Rob
    -
    Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......

  2. #2
    Join Date
    Jun 2001
    Location
    Melbourne/Aus (C# .Net 4.0)
    Posts
    686

    Re: DataGridView Selected Row

    ok - turned out to be straighforward.

    Whenever you set:
    row.Cells["MyColumn"].Style.BackColor = Color.Green;
    at the same time set:
    row.Cells["MyColumn"].Style.SelectionColor = Color.Green;
    Rob
    -
    Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)