Reducing gap in the DatagridView's panel

39 Views Asked by At

See screenshot

The dgv Inside the blue panel should be maximized in without any gap

Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
    If Not ValidateInput(CtrlDtl) Then Return
    If Not ValidateAddItem() Then Return

    AddRecord()
    ClearDetails()
    CalculateTotal()
    txtAmtWithGst.Select()

    With PanelDgvDocDtl
        .Size = New Size(dgvKnockOff.Width * 0.415, dgvKnockOff.Height - 24)
        Panel2.Height = .Height
        .Location = New Point(dgvKnockOff.Right - PanelDgvDocDtl.Width, pnlTop.Height + 25)
        .BringToFront()
    End With

    'this is my code that set size and location for the dgv

    PanelDgvDocDtl.Visible = True
    If dgvDocDtl.Rows.Count > 1 Then cmbBranchCode.Enabled = False

    clearMode = False 'setting the clear mode false to prevent certain control from being cleared, 
    Clear() 'maybe there is a better way to handle this
    clearMode = True 'setting it true. so the clear() method can clear all the controls it has. for other flow - agaesh

    pnlTotal.Visible = True
End Sub
0

There are 0 best solutions below