Gets or sets the default width of the grid columns in pixels.
[Visual Basic] Public Property PreferredColumnWidth As Integer [C#] public int PreferredColumnWidth {get; set;} [C++] public: __property int get_PreferredColumnWidth(); public: __property void set_PreferredColumnWidth(int); [JScript] public function get PreferredColumnWidth() : int; public function set PreferredColumnWidth(int);
The default width (in pixels) of columns in the grid. The default is 50.
If this value is set to AutoColumnSize, the grid will automatically size columns to the maximum width of the first 10 rows.
The following example sets the default column widths to a value passed to the method.
[Visual Basic]
Private Sub SetDefaultColWidth(defColWidth As Integer) DataGrid1.PreferredColumnWidth = defColWidth End Sub
DataGrid Class | DataGrid Members | System.WinForms Namespace | AutoColumnSize