VB.Net: DataGridView seems as if it is piercing the form

35 Views Asked by At

I'm having a graphical issue with a DataGridView.

Issue screenshot

As you can see the form looks like pierced from the DataGridView control.

The code of the DataGridView instantiation is this:

Private Sub pageAlarms_Load(sender As Object, e As EventArgs) Handles Me.Load
    Me.Width = MainForm.Width
    Me.Height = MainForm.Height
    Me.Dock = DockStyle.Fill


    dgvActiveAlarms = New DataGridView() 
    almBasePanel.Controls.Add(dgvActiveAlarms)

    With dgvActiveAlarms
        .Dock = DockStyle.Fill
        .Name = "activeAlarmsTable"
        .AutoSizeRowsMode =
            DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders
        .ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single
        .CellBorderStyle = DataGridViewCellBorderStyle.Single
        .GridColor = Color.Black
        .RowHeadersVisible = False

        .ColumnCount = 5

    End With
End Sub

I tried also to create the control from the designer, but with same result.

The page which contains the almBasePanel is a user control, instantiated in the main form load.

I could not find a topic with similar issue so I decided to submit this question, forgive me if I posted for a redundant argument.

Thank you, Giuse

0

There are 0 best solutions below