DataGridView Scroll show columns over others RRS feed

  • Question

  • I have a datagridview, and when i use scrollbar the columns shown over the others, like this image:

    i have tried DoubleBuffered like that:

    1- i created a module named "DoubleBuffer.vb"

    2- i add that code in it:

    Imports System
    Imports System.Reflection
    Imports System.Windows.Forms
    Module DoubleBuffer
        Public Sub DoubleBuffered(ByVal dgv As DataGridView, ByVal setting As Boolean)
            Dim dgvType As Type = dgv.[GetType]()
            Dim pi As PropertyInfo = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance Or BindingFlags.NonPublic)
            pi.SetValue(dgv, setting, Nothing)
        End Sub
    End Module

    3- i call that module in Load Event :

    DoubleBuffer.DoubleBuffered(DataGridView1, True)

    but it give me BLACK Cells

    so, what is the problem i faced here?

    • Edited by M.G.R Friday, June 29, 2018 4:25 PM
    Friday, June 29, 2018 4:22 PM

All replies

  • You should not need double buffering for that amount of records, something else must be going on to cause these issues other than simply loading data into your DataGridView.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, June 29, 2018 5:41 PM
  • i don't know what was happens exactly, i make some customize to datagridview like align header and select another colors.

    But anyway, the problem resolved by replacing datagridview with another one.

    • Proposed as answer by Stanly Fan Wednesday, July 4, 2018 2:14 AM
    Friday, June 29, 2018 5:48 PM