Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1017775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:45:21+00:00 2026-05-16T10:45:21+00:00

I have the next problem: TabControl has three TabPages. Every TabPage has its own

  • 0

I have the next problem:
TabControl has three TabPages. Every TabPage has its own DataGridView. On “Enter” event some rows change their background color.
When the form begin to initialize, the function, that changes color, is called. But DataGridView rows have their default background (background color hasn’t been changed). If I click on another TabPage and then come back to the first TabPage the function is called again and the background is changed. So, why it doesn’t happen at first time on the initialization stage (the function is called, but the rows don’t change their color). How can I force the DataGridView to change the background color of its rows at the initialization stage?
Thanks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:45:22+00:00Added an answer on May 16, 2026 at 10:45 am

    How are you changing the colour? You might want to look into the CellFormatting event to see whether you can explicitly paint the cell when it is visible to the user. That way each time it redraws the cell you can guarantee the colour will be correct. (Assuming you need different colours for the rows, otherwise just set the cell style and invalidate the control.

    UPDATE:

    It’s important that you reference the cellstyle via the event args, otherwise you will do recursion to work out the cell style that you are trying to access.

    private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
    {
        e.CellStyle.BackColor = Color.PaleGreen
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application I have next problem. I created master page and some content
In my fieldset I have labels next (side) to my textboxes, but for some
I have next problem: There is jquery accordion control. One of tab have div
I have the next problem: I need to process only 1 request at a
I have the next problem. In one of the cells (UITableViewCell) I need to
I'm new in Android development and I have the next question/problem. I'm playing around
I'm new in Android development and I have the next question/problem. I'm playing around
I've faced with a next problem: In our database we have objects with ids,
I got this next problem. I have a binary file, which I write to
I have a next problem. I need to represent a pressed keys combination in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.