Hi All
I have a method to configure a datagridview, meaning changing the column widths, format columns etc.
If I call the configuration meathod from the form load doesn't work because the form hasn't been totaly loaded and I dont get the correct size of the datagrid, to be able to adjust the clomns with.
How can I performed this.

Private Sub Custom_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        dgv_Custom.DataSource = dt_Custom
        Config_Datagrid()
    End Sub

Guess you could use the IsNothing function.
Or something like If MyDGV Is Nothing Then ...

Thanks for your reply but it didn't work.

Please post the codes for configuration method.

From my opinion you must have to check that config method thoroghly.

Here is the Configuration_Method.

 Private Sub dgv_Config()
        Try
            With Me.dgv_Custom
                .AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells
                .ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .DefaultCellStyle.Font = New Font("Microsoft Sans Serif", 10, FontStyle.Regular)
                .RowHeadersWidth = 30
                .Columns("Due Date < 4 Weeks").Width = 65
                .Columns("Due Date < 4 Weeks").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Room").Width = 200
                .Columns("OE#").Width = 75
                .Columns("OE#").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Colour").Width = 125
                .Columns("Colour").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("FloorPlan Issue#").Width = 75
                .Columns("FloorPlan Issue#").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Order Status").Width = 55
                .Columns("Order Status").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Order Form").Width = 75
                .Columns("Order Form").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Custom Retail").Width = 75
                .Columns("Custom Retail").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Custom Parts Category").Width = 75
                .Columns("Custom Parts Category").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Number of Custom Parts").Width = 75
                .Columns("Number of Custom Parts").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("P8 Custom Parts Start").Width = 85
                .Columns("P8 Custom Parts Start").DefaultCellStyle.Format = "MMM-dd-yy"
                .Columns("P8 Custom Parts Start").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("P7 Custom Parts Due").Width = 85
                .Columns("P7 Custom Parts Due").DefaultCellStyle.Format = "MMM-dd-yy"
                .Columns("P7 Custom Parts Due").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("P9 Finished Parts Start").Width = 85
                .Columns("P9 Finished Parts Start").DefaultCellStyle.Format = "MMM-dd-yy"
                .Columns("P9 Finished Parts Start").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("P10 Finished Parts Due").Width = 85
                .Columns("P10 Finished Parts Due").DefaultCellStyle.Format = "MMM-dd-yy"
                .Columns("P10 Finished Parts Due").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
                .Columns("Link").Visible = False
                .Columns("P8_stat").Visible = False
                .Columns("P7_Stat").Visible = False
                .Columns("P9_stat").Visible = False
                .Columns("P10_Stat").Visible = False
                .Columns("Rescheduled").Visible = False
                .Columns("Required").Visible = False
            End With
        Catch ex As Exception
            MsgBox(Me.Name & ".dgv_Config" & ex.Message)
        End Try

    End Sub

As per your 2nd post you declared the configuration method for datagridview is dgv_Config(), but you are calling Config_Datagrid().
These two are not same.

I changed it after the first post.