Cell Duplication Issue in DataGridView During Fast Scrolling in Fullscreen Mode with VB.NET

Christoph 0 Reputation points
2024-12-05T14:06:10.9566667+00:00

Hi everyone,

I’m encountering an issue with the DataGridView in my VB.NET app. When scrolling quickly in fullscreen mode, some cells get duplicated. The faster I scroll, the worse the issue becomes. Interestingly, this does not happen when the window is not maximized — it only occurs when the window is in fullscreen mode, and the effect is stronger the larger the window.

Here’s what I’ve tried:

  • DoubleBuffering is enabled.
  • .SuspendLayout() and .ResumeLayout() are used before and after filling the DataGridView, respectively.
  • MultiSelect is set to False.
  • AutoSize for rows and columns is disabled.
  • I’ve asked ChatGPT for suggestions (and tested multiple approaches).

The issue:

  • Fast scrolling causes whole rows to duplicate. This is a minor issue since it doesn’t affect functionality.
  • Selected cells get dragged with the scroll, and for a couple of seconds, the grid becomes unresponsive. The grid keeps scrolling even after I stop, and then the duplication disappears.
  • This issue happens specifically when scrolling quickly, and it affects the interface for a few seconds. The screen becomes unresponsive during that time.

GIF demonstration:

Here’s a GIF showing the problem. You can see that even after I stop scrolling, the grid continues to scroll. A selected cell is duplicated, and for a few seconds, I can't control anything. The scrolling continues, and after a brief delay, the duplication disappears.

scrollbug

Hochgeladenes Bild

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,760 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Jiachen Li-MSFT 32,961 Reputation points Microsoft Vendor
    2024-12-06T07:34:09.2433333+00:00

    Hi @Christoph ,

    You can try Using VirtualMode

    Enabling VirtualMode allows the DataGridView to load only the visible rows into memory, improving performance during scrolling.

    If possible, reduce the number of rows displayed at once by implementing pagination or filtering. Large datasets can cause rendering issues, especially in fullscreen mode.

    Best Regards.

    Jiachen Li


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.