Grid Control
The Grid control displays and operates on tabular data. It allows complete flexibility to sort, merge, and format tables containing strings.
Syntax
Grid
The properties, methods and events of the Grid control are described in the following table.
Properties Methods Events
CellAlignment AddItem Compare
CellBackColor, CellForeColor Clear (Grid) EnterCell
CellFontBold RemoveItem LeaveCell
CellFontItalic RowColChange
CellFontName Scroll (Grid)
CellFontSize SelChange
CellFontStrikeThrough
CellFontUnderline
CellHeight, CellLeft, CellTop, CellWidth
CellTextStyle
Clip
Col
ColAlignment
ColData
CollsVisible
ColPos
ColPosition, RowPosition
Cols, Rows
ColSel, RowSel
ColWidth
FillStyle (Grid)
FocusRect
ForeColor, ForeColorSel
GridColor
GridLines
GridLineWidth
HighLight
LeftCol
Redraw
RowHeight
RowHeightMin
RowIsVisible
RowPos
ScrollBars (Grid)
ScrollTrack
SelectionMode
Sort
Text (Grid)
TextArray
TextMatrix
TextStyle
TopRow
Version
WordWrap (Grid)
Remarks
The Grid control supports the following features:
Automatic regrouping of data during column adjustment.
Ability of each cell to contain text.
Changing of current cell text in code or at run time.
Word-wrap capability for text within cells.
The Grid control can be used in the following scenarios:
To implement a "sorting" data display that groups information by category, allowing the user to modify the order in which information is presented.
To create a spreadsheet with in-cell editing.
The Row and Col properties specify the current cell in a Grid. You can specify the current cell in code, or the user can change it at run time using the mouse or the arrow keys. The Text property references the contents of the current cell.
If a cell's text is too long to be displayed in the cell, and the WordWrap property is set to True, the text wraps to the next line within the same cell. To display the wrapped text, you may need to increase the cell's column width (ColWidth property) or row height (RowHeight property).
Use the Cols and Rows properties to determine the number of columns and rows in a Grid control.