Gets the number of visible columns.
[Visual Basic] Public ReadOnly Property VisibleColumnCount As Integer [C#] public int VisibleColumnCount {get;} [C++] public: __property int get_VisibleColumnCount(); [JScript] public function get VisibleColumnCount() : int;
The number of columns visible in the view port. The viewport is the rectangular area through which the grid is visible. The viewport's size depends on the size of the DataGrid control; if you allow users to resize the control, the viewport will also be affected.
The number of visible columns can change depending on their width. For example, if a default width for all columns is set, but a new column's width is set twice as large, the number of visible columns will be reduced by at least one.
The following example returns the number of visible columns.
[Visual Basic]
Private Function ReturnVisibleCols(ByVal myGrid As DataGrid) As Integer ReturnVisibleCols = myGrid.VisibleColumnCount End Function
DataGrid Class | DataGrid Members | System.WinForms Namespace | ColumnHeadersVisible | FirstVisibleColumn | VisibleRowCount