Skip to content

Width Property

Description

Specifies the minimal column width.

Property Type

Read-write property

Syntax (Visual Basic)

Public Property Width() As Long

Remarks

When the column is added, you specify the Width of the column. You can change the Width property at any time.

The column width cannot be sized smaller than the value in the Width property. AutoSize must be FALSE if the value in the Width property will be used.

If AutoSize or Resizable is TRUE, then the column Width can be smaller than the current value.

Example

Changing Column Width (Visual Basic)

This sample illustrates how to set and change the column width.

' Add this to the General code section  
Const COLUMN_NAME = 1  

' This code is placed in the Form_Load event  
Dim Column As GridColumn  

' The initial width is set to 300px, the Resizable parameter is set to FALSE because  
' we do not want AutoSize enabled.  
Set Column = wndGridControl.Columns.Add(COLUMN_NAME, "Name", 300, False)  

' Enable column resizing, we need to do this because the Resizable parameter in the Add method in the previous  
' line of code set BOTH AutoSize and Resizable to FALSE  
Column.Resizable = True  

' Change the column width from its initial value of 300px to 400px  
Column.Width = 400  

See Also

GridColumn Object


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.