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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting column size in a databound grid

Thread ID:





7825 Oct 10,2003 01:01 PM UTC Oct 10,2003 01:49 PM UTC WinForms 2
Tags: GridControl
Brian Bacon
Asked On October 10, 2003 01:01 PM UTC

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?

Administrator [Syncfusion]
Replied On 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

Brian Bacon
Replied On October 10, 2003 01:49 PM UTC

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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon