Results 1 to 4 of 4

Thread: [2005] - Colouring Rows In DataGridView

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question [2005] - Colouring Rows In DataGridView

    Hi All,

    Looking at the code from this Thread, when looping through the values, the http request can sometimes cause a "operation time out" when the connection is down / running really really slow. How would I mark the rows where the data failed to scrape?

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

    Re: [2005] - Colouring Rows In DataGridView

    Set the DefaultCellStyle.BackColor property of the row.
    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
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question Re: [2005] - Colouring Rows In DataGridView

    Hey jm,

    I tried the following combinations but it is not working as expected...

    Code:
    DataGridView2.Rows(I).DefaultCellStyle.BackColor = Color.Crimson
    - The row will flash red then return to transparent

    Code:
    DataGridView2.CurrentRow.DefaultCellStyle.BackColor = Color.Crimson
    - Returns and error message... Object not referenced to instance

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

    Re: [2005] - Colouring Rows In DataGridView

    The error message on the second code snippet would indicate that there is no current row, hence the CurrentRow property is Nothing.

    As for the first one, you must be changing the BackColor elsewhere as if you see the row flash red then that specific code is obviously working.
    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

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