We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Setting column size in a databound grid

I've a parent form, with an mdi child, with a custom panel with a derived data bound grid on it. I'd like to set the default column sizes when my app starts. Here is how I'm setting the widths: Public Sub LayoutGrid() Dim widths() As Integer = {25, 25, 190, 63, 63, 94} Me.mcItems.SetColWidth(0, 5, widths) End Sub I've tried calling this proceedure in my derived grid's OnCreateControl, in my panel's OnCreateControl and in my child form's Load. None of them do anything. However if I add a button to my panel that calls that proceedure it works just fine. How can I do this without requiring user interaction? Is there a better way to set the initial layout of the table?

2 Replies

AD Administrator Syncfusion Team October 10, 2003 01:23 PM UTC

Set databoundGrid.AllowResizeToFit = false to stop the grid from automatically sizing the columns after you set the column widths manually. Stefan

BB Brian Bacon October 10, 2003 01:49 PM UTC

Well now dont I feel sheepish... I thought I had done that. Thanks again Stefan.

Live Chat Icon For mobile
Up arrow icon