ILiteGridTurboCtrl Interface The ActiveX/COM Grid Control API — coclass LiteGridTurboCtrl | Design-time OCX pattern
Default dispinterface: _LiteGridTurboCtrl | Event source: _DLiteGridTurboCtrlEvents
Getting Started — Registered Mode
This is the traditional path: the OCX is registered once with regsvr32, you drop the control
on a form at design time, and you get IntelliSense and native event handlers. Everything below is
copy-paste. Deploying without admin rights instead? See
Registration-Free Deployment.
Quick Start (30 seconds)
- Register the OCX once, from an elevated prompt:
regsvr32 "C:\LiteGridTurbo\LiteGridTurbo_x64.ocx"(useLiteGridTurbo_x86.ocxfor 32-bit Office). - On your UserForm, right-click the Toolbox → Additional Controls → tick LiteGridTurboCtrl Class, then draw the control on the form.
- Name it
lgGridin the Properties window. Every event handler below is named after it, so if you call it something else, rename the handlers to match. - Tools → References → tick LiteGrid Turbo 1.0 Type Library. This is what gives you IntelliSense; the control works without it, but you lose autocomplete.
- Add a standard module named
modLiteGridLicense(below), then paste the form template into the form's code.
Keep the activation key in one place — the shared module below — and
call EnsureLicensed from each form. Pasting the key into every form is how keys end up in
screenshots and support emails.
modLiteGridLicense — shared module
Insert → Module, rename it to modLiteGridLicense, paste this whole
block, and edit the two constants once. Leave LG_KEY empty to use the evaluation window signed into your evaluation copy of the OCX; paste your purchased key there to activate.
' ===== modLiteGridLicense — START ============================================
Option Explicit
Private Const LG_COMPANY As String = "Your Company"
Private Const LG_KEY As String = "" ' empty = use the evaluation window signed into your copy
Private m_activated As Boolean
' Activates once per process (activation is not stored, so it runs on every launch).
' Safe to call from every form.
' Never passes a placeholder key: an invalid key raises a run-time error,
' which would abandon the rest of your Initialize routine.
Public Sub EnsureLicensed(ByVal ctrl As Object)
If m_activated Then Exit Sub
If ctrl Is Nothing Then Exit Sub
If Len(LG_KEY) = 0 Then Exit Sub ' evaluation copy: nothing to activate
On Error Resume Next
ctrl.ActivateLicense LG_COMPANY, LG_KEY
On Error GoTo 0
m_activated = True
End Sub
' ===== modLiteGridLicense — END ==============================================
Canonical per-form template
Paste into the form's code module. Assumes a design-time control named lgGrid and the
modLiteGridLicense module above.
Verified against a real Excel host.
Option Explicit
' ---- setup ----------------------------------------------------------------
Private Sub UserForm_Initialize()
On Error GoTo Fail
EnsureLicensed Me.lgGrid
' Columns first, then rows.
Me.lgGrid.AddColumn "Name", 150
Me.lgGrid.AddColumn "Department", 150
Me.lgGrid.AddColumn "Salary", 100
Me.lgGrid.AddRow Array("John Smith", "Engineering", 95000)
Me.lgGrid.AddRow Array("Jane Doe", "Marketing", 87000)
Me.lgGrid.AddRow Array("Bob Wilson", "Finance", 102000)
' Optional niceties
Me.lgGrid.Theme = 0 ' 0=Light 1=Dark 2=Excel-Classic 3=High-Contrast
Me.lgGrid.ShowFilterButtons = True
Exit Sub
Fail:
MsgBox "LiteGrid Turbo init failed: " & Err.Number & " " & Err.Description, vbCritical
End Sub
' ---- native events -------------------------------------------------------
' Registered mode wires these by NAME: <controlName>_<EventName>. No WithEvents.
' Pick them from the VBA editor's object/procedure dropdowns to get the exact
' signature — a typo in the name means the handler is simply never called.
Private Sub lgGrid_ItemClick(ByVal rowIndex As Long, ByVal columnIndex As Long)
Debug.Print "clicked row " & rowIndex & ", col " & columnIndex
End Sub
Private Sub lgGrid_CellValueChanged(ByVal rowIndex As Long, ByVal columnIndex As Long, _
ByVal oldValue As Variant, ByVal newValue As Variant)
Debug.Print "cell " & rowIndex & "," & columnIndex & ": " & _
CStr(oldValue) & " -> " & CStr(newValue)
End Sub
' Cancellable: set Cancel = True to veto the operation.
Private Sub lgGrid_BeforeRowDelete(ByVal rowIndex As Long, Cancel As Boolean)
If MsgBox("Delete this row?", vbYesNo + vbQuestion) = vbNo Then
Cancel = True
End If
End Sub
' ---- teardown ------------------------------------------------------------
' On Error Resume Next because by the time this runs the control's window
' may already have been destroyed with the form.
Private Sub UserForm_Terminate()
On Error Resume Next
Me.lgGrid.Clear
End Sub
.Object
Access wraps ActiveX controls, so Me.lgGrid gives you Access's wrapper rather than the
grid. Take a typed reference once and use that:
Private m_grid As LiteGridTurboLib.LiteGridTurboCtrl
Private Sub Form_Load()
Set m_grid = Me.lgGrid.Object ' .Object peels Access's wrapper
EnsureLicensed m_grid
m_grid.AddColumn "Name", 150
End Sub
Event handlers stay named after the control (lgGrid_ItemClick), not after
m_grid. In Excel/MSForms no .Object is needed —
Me.lgGrid is the control already.
Methods for loading data from arrays, Excel Ranges, Recordsets, and JSON. Includes async loading, streaming, and preset modes.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| LoadFromArray | data As Variant | Load data from a 2D Variant array | |
| LoadFromRange | pRange As Object | Load data from an Excel Range object | |
| LoadFromRecordset | pRecordset As Object | Load data from a DAO or ADO Recordset | |
| LoadFromJson | json As String | Load data from a JSON array-of-objects string | |
| AutoDetectColumns | firstRowIsHeader As Boolean | Detect column types; optionally treat first row as headers | |
| Clear | Remove all data and columns | ||
| GetRowCount | Long | Return total number of rows | |
| GetColumnCount | Long | Return total number of columns | |
| QuickBind | data As Variant, firstRowIsHeader As Boolean | One-call grid setup: load data, detect types, auto-fit, enable filters/sort/status bar | |
| CancelLoad | Cancel an in-progress load operation | ||
| IsLoading | Property, R | Boolean | True if a load operation is currently in progress |
| SetMode | modeName As String | Apply named preset: "Excel", "ReadOnly", "Dashboard", "DataEntry" | |
| BeginStreaming | Start streaming mode — suppresses sort/filter until EndStreaming | ||
| AppendRows | data As Variant | Append rows from 2D array during streaming (no full reload) | |
| EndStreaming | End streaming — rebuild view order, apply sort/filter |
Per-Member Usage
' LoadFromArray — load from 2D array
Dim data(1 To 1000, 1 To 5) As Variant
Dim i As Long
For i = 1 To 1000
data(i, 1) = "Item " & i
data(i, 2) = Int(Rnd * 100)
data(i, 3) = Round(Rnd * 999.99, 2)
Next
m_grid.LoadFromArray data
' LoadFromRange — load from Excel Range
m_grid.LoadFromRange ActiveSheet.Range("A1:F500")
' LoadFromRecordset — load from DAO/ADO Recordset
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT * FROM Orders")
m_grid.LoadFromRecordset rs
rs.Close
' LoadFromJson — load from JSON string
m_grid.LoadFromJson "[{""name"":""Alice"",""age"":30},{""name"":""Bob"",""age"":25}]"
' AutoDetectColumns — first row becomes headers
m_grid.AutoDetectColumns True
' Clear — remove all data and columns
m_grid.Clear
' GetRowCount / GetColumnCount — query dimensions
Debug.Print "Rows: " & m_grid.GetRowCount
Debug.Print "Columns: " & m_grid.GetColumnCount
' CancelLoad — cancel in-progress load
m_grid.CancelLoad
' IsLoading (Property) — check if loading
If m_grid.IsLoading Then m_grid.CancelLoad
Methods for adding, sizing, and configuring columns.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| AddColumn | header As String, width As Long | Add a column with header text and pixel width | |
| SetColumnWidth | columnIndex As Long, width As Long | Set column width in pixels | |
| GetColumnWidth | columnIndex As Long | Long | Get column width in pixels |
| SetColumnHeader | columnIndex As Long, header As String | Set column header text | |
| GetColumnHeader | columnIndex As Long | String | Get column header text |
| SetColumnVisible | columnIndex As Long, visible As Boolean | Show or hide a column | |
| AutoFitColumns | Auto-size all columns to fit their content | ||
| SetColumnAutoSize | colIndex As Long, mode As Long | Set auto-size mode: 0=None, 1=Content, 2=Header, 3=Both, 4=Fill | |
| SetColumnAlignment | columnIndex As Long, alignment As Long | Set column alignment: 0=Left, 1=Center, 2=Right | |
| GetColumnAlignment | columnIndex As Long | Long | Get column alignment: 0=Left, 1=Center, 2=Right |
Per-Member Usage
' AddColumn — add columns with header and width
m_grid.AddColumn "Name", 150
m_grid.AddColumn "Score", 80
' SetColumnWidth / GetColumnWidth — resize columns
m_grid.SetColumnWidth 0, 200
Dim w As Long: w = m_grid.GetColumnWidth(0)
' SetColumnHeader / GetColumnHeader — rename columns
m_grid.SetColumnHeader 0, "Customer Name"
Dim h As String: h = m_grid.GetColumnHeader(0)
' SetColumnVisible — show/hide columns
m_grid.SetColumnVisible 3, False ' Hide column 3
' AutoFitColumns — auto-size all columns
m_grid.AutoFitColumns
' SetColumnAutoSize — per-column auto-size mode
m_grid.SetColumnAutoSize 0, 3 ' Fit to header and content
m_grid.SetColumnAutoSize 4, 4 ' Fill remaining width
Methods for adding, inserting, deleting, sizing, and enabling/disabling rows.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| AddRow | values As Variant | Append a row with values | |
| InsertRow | rowIndex As Long, values As Variant | Insert a row at a specific index | |
| DeleteRow | rowIndex As Long | Delete a single row | |
| DeleteSelectedRows | Delete all currently selected rows | ||
| SetRowEnabled | rowIndex As Long, enabled As Boolean | Mark a row as enabled or disabled. Disabled rows render with Text_Disabled / State_Disabled tint and skip input. | |
| ClearAllRowStates | Reset every row to the Normal state. Clears all per-row enabled/disabled flags. |
Per-Member Usage
' AddRow — append a row
m_grid.AddRow Array("Charlie", 78, "Active")
' InsertRow — insert at specific index
m_grid.InsertRow 0, Array("First Row", 100, "Top")
' DeleteRow — delete a single row
m_grid.DeleteRow 5
' DeleteSelectedRows — delete all selected rows
m_grid.DeleteSelectedRows
' SetRowEnabled — grey out a row and skip input
m_grid.SetRowEnabled 3, False
m_grid.SetRowEnabled 3, True ' Restore
' ClearAllRowStates — restore every row to Normal
m_grid.ClearAllRowStates
Methods for reading and writing individual cell values, colors, and formatting.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| GetCellValue | row As Long, col As Long | String | Get cell value as String |
| SetCellValue | row As Long, col As Long, value As String | Set cell value as String | |
| GetCell | row As Long, col As Long | Variant | Get cell value as typed Variant |
| SetCell | row As Long, col As Long, value As Variant | Set cell value as typed Variant | |
| SetCellFontStyle | row As Long, col As Long, style As Long | Set cell font style: 0=Normal, 1=Bold, 2=Italic, 3=BoldItalic | |
| SetCellColor | row As Long, col As Long, backColor As Long, foreColor As Long | Set per-cell back and fore color override | |
| ClearCellColor | row As Long, col As Long | Clear per-cell color override | |
| SetCellRange | startRow As Long, startCol As Long, data As Variant | Bulk cell update from a 2D Variant array |
Per-Member Usage
' GetCellValue / SetCellValue — string-based cell access
m_grid.SetCellValue 0, 1, "Updated"
Dim val As String: val = m_grid.GetCellValue(0, 1)
' GetCell / SetCell — typed Variant access
m_grid.SetCell 0, 2, 42.5 ' Double
m_grid.SetCell 0, 3, True ' Boolean
m_grid.SetCell 0, 4, Now() ' Date
Dim v As Variant: v = m_grid.GetCell(0, 2)
' SetCellFontStyle — bold, italic, or both
m_grid.SetCellFontStyle 0, 0, 1 ' Bold
m_grid.SetCellFontStyle 1, 0, 3 ' Bold + Italic
Methods and properties for selecting rows, cells, and querying the selection state.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SelectRow | rowIndex As Long | Select a row by index | |
| SelectAll | Select all rows | ||
| ClearSelection | Deselect all rows | ||
| GetSelectedRow | Long | Return first selected row index, or -1 if none | |
| GetSelectedRows | Variant | Return selected row indices as array | |
| IsRowSelected | rowIndex As Long | Boolean | Check if a specific row is selected |
| SelectionMode | Property, R/W | Long | Controls selection behavior. 0=Row: click selects entire row, Up/Down arrow nav. 1=Cell: click selects single cell, all 4 arrow keys navigate, Shift creates rectangular block. 2=Column: click selects entire column, Left/Right arrow nav. |
| MultiSelect | Property, R/W | Boolean | Enable Ctrl+Click and Shift+Click multi-selection |
Per-Member Usage
' SelectRow — select a specific row
m_grid.SelectRow 5
' SelectAll — select all rows
m_grid.SelectAll
' ClearSelection — deselect everything
m_grid.ClearSelection
' GetSelectedRow — first selected row (-1 if none)
Dim row As Long: row = m_grid.GetSelectedRow
If row >= 0 Then Debug.Print m_grid.GetCellValue(row, 0)
' GetSelectedRows — all selected row indices
Dim indices As Variant: indices = m_grid.GetSelectedRows
If IsArray(indices) Then
Dim i As Long
For i = LBound(indices) To UBound(indices)
Debug.Print "Row " & indices(i)
Next
End If
' IsRowSelected — check specific row
If m_grid.IsRowSelected(3) Then Debug.Print "Row 3 selected"
' SelectionMode (Property) — controls selection and navigation behavior
m_grid.SelectionMode = 0 ' Row: click selects entire row, Up/Down arrows
m_grid.SelectionMode = 1 ' Cell: click selects one cell, all 4 arrows navigate, Shift = block
m_grid.SelectionMode = 2 ' Column: click selects entire column, Left/Right arrows
' MultiSelect (Property) — enable multi-selection
m_grid.MultiSelect = True
Methods for single-column, multi-column, and natural sort with case control.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| Sort | columnIndex As Long, sortOrder As Long | Sort by column: 0=Ascending, 1=Descending | |
| SortEx | columnIndex As Long, sortMode As Long | Extended sort: 0=Asc, 1=Desc, 2=AscNoCase, 3=DescNoCase, 4=Natural | |
| SortMulti | spec As String | Multi-column sort (up to 3 levels): "col:direction,..." | |
| ClearSort | Restore original row order |
Per-Member Usage
' Sort — single column ascending or descending
m_grid.Sort 0, 0 ' Column 0 ascending
m_grid.Sort 2, 1 ' Column 2 descending
' SortEx — extended sort modes
m_grid.SortEx 0, 4 ' Natural sort (File1, File2, File10)
' SortMulti — multi-column sort
m_grid.SortMulti "0:asc,2:desc"
' ClearSort — restore original order
m_grid.ClearSort
Text, numeric, regex, value-list, and range filters with state persistence.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SetColumnFilter | colIndex As Long, filterMode As Long, pattern As String | Set text filter: 0=Contains, 1=Equals, 2=StartsWith, 3=EndsWith, 4=Regex | |
| SetColumnNumericFilter | colIndex As Long, mode As Long, threshold As Double | Numeric filter: 5=GT, 6=LT, 7=GE, 8=LE, 10=NotEqual | |
| SetColumnNumericFilterRange | colIndex As Long, minVal As Double, maxVal As Double | Numeric range filter (inclusive) | |
| SetColumnValueListFilter | colIndex As Long, acceptedValues As Variant, includeBlanks As Boolean | Filter to specific values only | |
| ClearColumnFilter | colIndex As Long | Remove filter from a column | |
| ClearAllFilters | Remove all column filters | ||
| GetFilteredRowCount | Long | Return number of visible (filtered) rows | |
| GetDistinctValues | colIndex As Long | Variant | Return sorted array of unique values in a column |
| GetColumnFilterMode | colIndex As Long | Long | Return active filter mode, or -1 if none |
| GetColumnFilterPattern | colIndex As Long | String | Return active filter pattern string |
| GetColumnValueListFilter | colIndex As Long | Variant | Return active value-list filter array, or Empty |
| GetFilterState | String | Return all filters as JSON for persistence | |
| SetFilterState | jsonState As String | Restore filters from previously saved JSON state | |
| ShowFilterButtons | Property, R/W | Boolean | Show filter icon buttons in column headers |
Per-Member Usage
' SetColumnFilter — text filters
m_grid.SetColumnFilter 0, 0, "alice" ' Contains "alice"
m_grid.SetColumnFilter 1, 4, "^\d{3}$" ' Regex: exactly 3 digits
' SetColumnNumericFilter — numeric comparisons
m_grid.SetColumnNumericFilter 2, 5, 100 ' Column 2 > 100
' SetColumnNumericFilterRange — between min and max
m_grid.SetColumnNumericFilterRange 2, 50, 200
' SetColumnValueListFilter — allow specific values
m_grid.SetColumnValueListFilter 3, Array("Active", "Pending"), True
' ClearColumnFilter / ClearAllFilters
m_grid.ClearColumnFilter 0
m_grid.ClearAllFilters
' GetFilteredRowCount — visible row count
Debug.Print "Visible: " & m_grid.GetFilteredRowCount
' GetDistinctValues — unique values in a column
Dim vals As Variant: vals = m_grid.GetDistinctValues(3)
' GetColumnFilterMode — check if column is filtered
If m_grid.GetColumnFilterMode(0) >= 0 Then Debug.Print "Filtered"
' GetColumnFilterPattern — current filter text
Dim p As String: p = m_grid.GetColumnFilterPattern(0)
' GetColumnValueListFilter — current value list
Dim vl As Variant: vl = m_grid.GetColumnValueListFilter(3)
' GetFilterState / SetFilterState — save/restore filters
Dim state As String: state = m_grid.GetFilterState
m_grid.SetFilterState state
' ShowFilterButtons (Property) — header filter icons
m_grid.ShowFilterButtons = True
Methods for exporting grid data to CSV, JSON, HTML, clipboard, or 2D array.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| ExportToCSV | filePath As String | Export grid data to a CSV file | |
| ExportToJson | String | Export grid data as JSON array-of-objects | |
| ExportToHTML | String | Export grid data as HTML table | |
| CopySelectedToClipboard | Copy selected rows as tab-delimited text to clipboard | ||
| GetDataArray | Variant | Return all data as a 2D Variant array | |
| PasteFromClipboard | Paste clipboard data into grid at current selection | ||
| ExportToCSVEx | filePath As String, includeHidden As Boolean | Export to CSV. includeHidden=True exports ALL rows regardless of filters. | |
| CopyWithHeaders | includeHeaders As Boolean | Copy selected rows to clipboard with optional column headers | |
| PasteSpecial | pasteMode As Long | Paste with options: 0=ValuesOnly, 1=SkipBlanks |
Per-Member Usage
' ExportToCSV — save to CSV file
m_grid.ExportToCSV "C:\Reports\data.csv"
' ExportToJson — get JSON string
Dim json As String: json = m_grid.ExportToJson
' ExportToHTML — get HTML table string
Dim html As String: html = m_grid.ExportToHTML
' CopySelectedToClipboard — copy to clipboard
m_grid.CopySelectedToClipboard
' GetDataArray — return all data as 2D array
Dim data As Variant: data = m_grid.GetDataArray
Read/write properties controlling the grid's visual appearance, theme, and editing behavior.
| Property | Type | R/W | Description |
|---|---|---|---|
| GridLines | Long | R/W | 0=None, 1=Horizontal, 2=Vertical, 3=Both |
| BackColor | OLE_COLOR | R/W | Default row background color |
| ForeColor | OLE_COLOR | R/W | Default text color |
| AlternateRowColor | OLE_COLOR | R/W | Alternating row background color. The same setting as the Surface_Alt theme role, so a later ApplyThemeJson that names that role replaces it. |
| AllowEditing | Boolean | R/W | Enable in-cell editing |
| ShowRowNumbers | Boolean | R/W | Show row number column |
| ShowTooltips | Boolean | R/W | Show tooltips for truncated text |
| Theme | Long | R/W | 0=Light, 1=Dark, 2=Excel-Classic, 3=High-Contrast |
| EditAdvanceOnEnter | Boolean | R/W | Enter commits edit and advances to next row |
Per-Member Usage
' Theme — set visual theme
m_grid.Theme = 1 ' Dark theme
' GridLines — control grid lines
m_grid.GridLines = 3 ' Both horizontal and vertical
' BackColor / ForeColor / AlternateRowColor — color scheme
m_grid.BackColor = RGB(255, 255, 255)
m_grid.ForeColor = RGB(51, 51, 51)
m_grid.AlternateRowColor = RGB(245, 245, 250)
' AllowEditing — enable in-cell editing
m_grid.AllowEditing = True
' ShowRowNumbers — row number column
m_grid.ShowRowNumbers = True
' ShowTooltips — tooltips for truncated text
m_grid.ShowTooltips = True
' EditAdvanceOnEnter — Enter advances to next row
m_grid.EditAdvanceOnEnter = True
Read/write properties for customizing column header appearance.
| Property | Type | R/W | Description |
|---|---|---|---|
| HeaderBackColor | OLE_COLOR | R/W | Header background color |
| HeaderForeColor | OLE_COLOR | R/W | Header text color |
| HeaderHoverColor | OLE_COLOR | R/W | Header hover background color |
| HeaderHoverForeColor | OLE_COLOR | R/W | Header hover text color |
| HeaderFontName | String | R/W | Header font name |
| HeaderFontSize | Long | R/W | Header font size in points |
| HeaderFontBold | Boolean | R/W | Header bold text |
| HeaderHeight | Long | R/W | Header height in pixels |
Per-Member Usage
' HeaderBackColor / HeaderForeColor — header colors
m_grid.HeaderBackColor = RGB(33, 37, 41)
m_grid.HeaderForeColor = RGB(255, 255, 255)
' HeaderHoverColor / HeaderHoverForeColor — hover state
m_grid.HeaderHoverColor = RGB(50, 55, 60)
m_grid.HeaderHoverForeColor = RGB(200, 220, 255)
' HeaderFontName / HeaderFontSize / HeaderFontBold — header font
m_grid.HeaderFontName = "Segoe UI"
m_grid.HeaderFontSize = 10
m_grid.HeaderFontBold = True
' HeaderHeight — header row height
m_grid.HeaderHeight = 32
Read/write properties for row height, density, padding, font, and hover colors.
| Property | Type | R/W | Description |
|---|---|---|---|
| RowHeight | Long | R/W | Default row height (16-100 pixels) |
| RowDensity | Long | R/W | 0=Compact, 1=Normal, 2=Comfortable |
| CellPadding | Long | R/W | Horizontal padding (2-20 pixels) |
| TextVAlign | Long | R/W | 0=Top, 1=Center, 2=Bottom |
| RowFontName | String | R/W | Row font name |
| RowFontSize | Long | R/W | Row font size in points |
| HoverBackColor | OLE_COLOR | R/W | Row hover background color |
| HoverForeColor | OLE_COLOR | R/W | Row hover text color |
Per-Member Usage
' RowHeight — default row height
m_grid.RowHeight = 24
' RowDensity — 0=Compact, 1=Normal, 2=Comfortable
m_grid.RowDensity = 1
' CellPadding — horizontal cell padding
m_grid.CellPadding = 6
' TextVAlign — vertical text alignment
m_grid.TextVAlign = 1 ' Center
' RowFontName / RowFontSize — row font
m_grid.RowFontName = "Segoe UI"
m_grid.RowFontSize = 9
' HoverBackColor / HoverForeColor — hover state
m_grid.HoverBackColor = RGB(230, 240, 255)
m_grid.HoverForeColor = RGB(0, 0, 0)
Read/write properties for customizing the selected row/cell colors.
| Property | Type | R/W | Description |
|---|---|---|---|
| SelectionBackColor | OLE_COLOR | R/W | Selected row/cell background color |
| SelectionForeColor | OLE_COLOR | R/W | Selected row/cell text color |
Per-Member Usage
' SelectionBackColor / SelectionForeColor — selection colors
m_grid.SelectionBackColor = RGB(0, 120, 215)
m_grid.SelectionForeColor = RGB(255, 255, 255)
Methods for setting column data types and display formats.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SetColumnType | colIndex As Long, colType As Long | Set column type: 0=Auto, 1=String, 2=Integer, 3=Double, 4=Date, 5=Boolean | |
| GetColumnType | colIndex As Long | Long | Get column type |
| SetColumnFormat | colIndex As Long, formatString As String | Set display format (e.g. "#,##0.00", "yyyy-mm-dd") | |
| GetColumnFormat | colIndex As Long | String | Get display format string |
Per-Member Usage
' SetColumnType / GetColumnType — set/get column data type
m_grid.SetColumnType 2, 3 ' Column 2 = Double
Dim t As Long: t = m_grid.GetColumnType(2)
' SetColumnFormat / GetColumnFormat — display format
m_grid.SetColumnFormat 2, "#,##0.00"
m_grid.SetColumnFormat 4, "yyyy-mm-dd"
Dim fmt As String: fmt = m_grid.GetColumnFormat(2)
Methods for freezing columns and rows so they remain visible during scrolling.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SetFrozenColumns | count As Long | Freeze the first N columns from the left | |
| GetFrozenColumns | Long | Get number of frozen columns | |
| SetFrozenRows | count As Long | Freeze the first N rows from the top | |
| GetFrozenRows | Long | Get number of frozen rows | |
| FreezeLineColor | Property, R/W | Long | Color of the freeze line separator (OLE_COLOR) |
| FreezeLineWidth | Property, R/W | Long | Width of the freeze line separator in pixels |
Per-Member Usage
' SetFrozenColumns / GetFrozenColumns — freeze columns
m_grid.SetFrozenColumns 2 ' Freeze first 2 columns
Dim n As Long: n = m_grid.GetFrozenColumns
' SetFrozenRows / GetFrozenRows — freeze rows
m_grid.SetFrozenRows 1 ' Freeze header row
Dim fr As Long: fr = m_grid.GetFrozenRows
Methods for loading icons from files, assigning them to cells/columns/value mappings, and drawing built-in vector icons that adapt to theme, state, and DPI without any external image files.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| LoadIconFromFile | filePath As String | Long | Load .ico, .bmp or .png file (PNG alpha preserved); returns icon ID |
| RemoveIcon | iconId As Long | Remove a loaded icon | |
| GetIconCount | Long | Return number of loaded icons | |
| SetCellIcon | row As Long, col As Long, iconId As Long | Assign icon to a specific cell | |
| ClearCellIcon | row As Long, col As Long | Remove icon from a cell | |
| GetCellIcon | row As Long, col As Long | Long | Get icon ID assigned to a cell |
| SetColumnIconMap | colIndex As Long, value As String, iconId As Long | Map a cell value to an icon automatically | |
| ClearColumnIconMap | colIndex As Long | Remove all icon mappings for a column | |
| SetColumnDefaultIcon | colIndex As Long, iconId As Long | Set fallback icon when no mapping matches | |
| SetColumnIconLayout | colIndex As Long, layout As Long | Icon layout: 0=None, 1=IconOnly, 2=IconLeft, 3=IconRight | |
| AddIconThreshold | colIndex As Long, minVal As Double, maxVal As Double, iconId As Long | Add icon set threshold: cells with value in [minVal, maxVal) show iconId | |
| ClearIconThresholds | colIndex As Long | Clear all icon set thresholds for a column | |
| SetCellBuiltinIcon | row As Long, col As Long, iconId As Long | Set a built-in vector icon (LiteGridBuiltinIcon, 0–7) on a specific cell. Overrides column rules. | |
| ClearCellBuiltinIcon | row As Long, col As Long | Clear the built-in icon override on a specific cell | |
| SetColumnBuiltinIcon | colIndex As Long, iconId As Long | Set a single built-in icon for every cell in a column | |
| ClearColumnBuiltinIcon | colIndex As Long | Remove a column-wide built-in icon | |
| SetColumnBuiltinIconMap | colIndex As Long, value As String, iconId As Long | Map an exact display value to a built-in icon (e.g. "OK" → lgIconCheck) | |
| AddBuiltinIconThreshold | colIndex As Long, minVal As Double, maxVal As Double, iconId As Long | Numeric range rule for built-in icons: [minVal, maxVal); first match wins | |
| SetColumnBuiltinIconDefault | colIndex As Long, iconId As Long | Default built-in icon when no rule matches. Pass -1 to clear. | |
| ClearColumnBuiltinIconRule | colIndex As Long | Clear all built-in icon rules for a column (per-cell overrides retained) | |
| IconSize | Property, R/W | Long | Runtime ImageList icon size in pixels (4–128). Rescales ImageList and invalidates vector geometry cache. |
Built-in icon resolver priority (first match wins): cell built-in → column-wide built-in → value map → numeric threshold → column default → external icon (LoadIconFromFile) → none.
Per-Member Usage
' LoadIconFromFile — load icons
Dim iconOK As Long: iconOK = m_grid.LoadIconFromFile("C:\Icons\check.ico")
Dim iconWarn As Long: iconWarn = m_grid.LoadIconFromFile("C:\Icons\warning.ico")
' RemoveIcon / GetIconCount — manage loaded icons
m_grid.RemoveIcon iconOK
Debug.Print "Icons loaded: " & m_grid.GetIconCount
' SetCellIcon / ClearCellIcon / GetCellIcon — per-cell icons
m_grid.SetCellIcon 0, 0, iconOK
m_grid.ClearCellIcon 0, 0
Dim id As Long: id = m_grid.GetCellIcon(0, 0)
' SetColumnIconMap — auto-map values to icons
m_grid.SetColumnIconMap 3, "Active", iconOK
m_grid.SetColumnIconMap 3, "Error", iconWarn
' ClearColumnIconMap — remove all mappings
m_grid.ClearColumnIconMap 3
' SetColumnDefaultIcon — fallback icon
m_grid.SetColumnDefaultIcon 3, iconOK
' SetColumnIconLayout — icon position
m_grid.SetColumnIconLayout 3, 2 ' Icon on the left of text
' Built-in vector icons (no external files needed) — values 0..7
' SetCellBuiltinIcon — per-cell override
m_grid.SetCellBuiltinIcon 0, 3, 1 ' lgIconCheck
m_grid.ClearCellBuiltinIcon 0, 3
' SetColumnBuiltinIcon — whole column
m_grid.SetColumnBuiltinIcon 5, 6 ' lgIconStar
m_grid.ClearColumnBuiltinIcon 5
' SetColumnBuiltinIconMap — value-to-icon mapping
m_grid.SetColumnBuiltinIconMap 3, "OK", 1 ' lgIconCheck
m_grid.SetColumnBuiltinIconMap 3, "Fail", 2 ' lgIconCross
m_grid.SetColumnBuiltinIconMap 3, "Warn", 3 ' lgIconWarning
' AddBuiltinIconThreshold — numeric range rules
m_grid.AddBuiltinIconThreshold 2, 0, 50, 5 ' lgIconArrowDown
m_grid.AddBuiltinIconThreshold 2, 50, 80, 0 ' lgIconCircle
m_grid.AddBuiltinIconThreshold 2, 80, 101, 4 ' lgIconArrowUp
' SetColumnBuiltinIconDefault — fallback when no rule matches
m_grid.SetColumnBuiltinIconDefault 2, 7 ' lgIconDiamond
m_grid.SetColumnBuiltinIconDefault 2, -1 ' Clear default
' ClearColumnBuiltinIconRule — wipe all column-level rules
m_grid.ClearColumnBuiltinIconRule 2
' IconSize (Property) — runtime icon size in pixels (4..128)
m_grid.IconSize = 24
Methods for enabling automatic color gradient backgrounds on numeric columns.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SetColumnHeatmap | colIndex As Long, enabled As Boolean | Enable or disable heatmap coloring | |
| SetHeatmapColors | colIndex As Long, lowColor As Long, midColor As Long, highColor As Long | Set low/mid/high gradient colors | |
| SetHeatmapRange | colIndex As Long, minVal As Double, maxVal As Double | Set explicit value range (disables auto-range) |
Per-Member Usage
' SetColumnHeatmap — enable heatmap on column
m_grid.SetColumnHeatmap 2, True
' SetHeatmapColors — custom gradient colors
m_grid.SetHeatmapColors 2, RGB(255, 200, 200), RGB(255, 255, 200), RGB(200, 255, 200)
' SetHeatmapRange — explicit min/max range
m_grid.SetHeatmapRange 2, 0, 100
Methods for adding, removing, and configuring conditional formatting rules with 9 rule types.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| AddFormatRule | colIndex As Long, ruleType As Long, threshold As Variant, backColor As Long, foreColor As Long | Long | Add rule: 0=GT, 1=LT, 2=Equal, 3=Contains, 4=Between, 5=Top10%, 6=Bottom10%, 7=Duplicate, 8=Unique |
| RemoveFormatRule | ruleId As Long | Remove a specific formatting rule | |
| ClearFormatRules | colIndex As Long | Clear rules for column, or -1 for all columns | |
| SetFormatRuleIcon | ruleId As Long, iconId As Long | Associate an icon with a formatting rule | |
| SetFormatRuleThreshold2 | ruleId As Long, threshold2 As Variant | Set upper bound for Between rules (ruleType=4) | |
| AddRowFormatRule | evalColumn As Long, ruleType As Long, threshold As Variant, backColor As Long, foreColor As Long | Long | Add row-scope format rule: evaluates one column and colors that column's cell. Does not currently fill the whole row. |
Remarks: AddRowFormatRule records a row scope, but the renderer evaluates rules per column and applies the colors only to the evaluated column's own cell, so in this build its visible effect is the same as AddFormatRule. To tint a whole row today, add one rule per column with the same threshold.
Per-Member Usage
' AddFormatRule — highlight values > 90 in green
Dim ruleId As Long
ruleId = m_grid.AddFormatRule(2, 0, 90, RGB(200, 255, 200), RGB(0, 100, 0))
' AddFormatRule — highlight duplicates in yellow
Dim dupRule As Long
dupRule = m_grid.AddFormatRule(0, 7, "", RGB(255, 255, 200), RGB(0, 0, 0))
' SetFormatRuleThreshold2 — Between rule (50-100)
Dim betweenRule As Long
betweenRule = m_grid.AddFormatRule(2, 4, 50, RGB(255, 255, 200), RGB(0, 0, 0))
m_grid.SetFormatRuleThreshold2 betweenRule, 100
' SetFormatRuleIcon — associate icon with rule
m_grid.SetFormatRuleIcon ruleId, iconOK
' RemoveFormatRule / ClearFormatRules — cleanup
m_grid.RemoveFormatRule ruleId
m_grid.ClearFormatRules 2 ' Clear column 2 rules
m_grid.ClearFormatRules -1 ' Clear ALL rules
Methods for rendering in-cell line, bar, and win/loss charts.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SetColumnSparkline | colIndex As Long, sparkType As Long | Set sparkline type: 0=None, 1=Line, 2=Bar, 3=WinLoss | |
| SetSparklineData | row As Long, col As Long, dataPoints As Variant | Set sparkline data points as array of Doubles | |
| SetSparklineDataCSV | row As Long, col As Long, csvData As String | Set sparkline data from comma-separated string | |
| SetSparklineColors | colIndex As Long, lineColor As Long, fillColor As Long, highColor As Long, lowColor As Long | Set sparkline colors for line, fill, high/low points |
Per-Member Usage
' SetColumnSparkline — enable sparkline rendering
m_grid.SetColumnSparkline 4, 1 ' Line sparkline
' SetSparklineData — array method
m_grid.SetSparklineData 0, 4, Array(10.5, 20.3, 15.0, 25.7, 18.2)
' SetSparklineDataCSV — CSV string method
m_grid.SetSparklineDataCSV 1, 4, "12.0,18.5,14.2,22.1,16.8"
' SetSparklineColors — custom sparkline colors
m_grid.SetSparklineColors 4, RGB(0, 120, 215), RGB(220, 235, 252), _
RGB(0, 176, 80), RGB(255, 0, 0)
Methods for adding input validation rules to columns for in-cell editing.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| AddValidationRule | colIndex As Long, ruleType As Long, param1 As Variant, param2 As Variant | Long | Add rule: 0=Required, 1=MinLength, 2=MaxLength, 3=Regex, 4=NumericRange, 5=CustomList |
| RemoveValidationRule | ruleId As Long | Remove a specific validation rule | |
| ClearValidationRules | colIndex As Long | Clear rules for column, or -1 for all |
Per-Member Usage
' AddValidationRule — required field, min length
m_grid.AddValidationRule 0, 0, "", "" ' Required
m_grid.AddValidationRule 0, 1, 2, "" ' Min length 2
' AddValidationRule — numeric range 0-100
m_grid.AddValidationRule 2, 4, 0, 100
' AddValidationRule — regex pattern
m_grid.AddValidationRule 3, 3, "^[A-Z]{2}\d{4}$", ""
' RemoveValidationRule / ClearValidationRules
m_grid.RemoveValidationRule ruleId
m_grid.ClearValidationRules 0 ' Clear column 0
m_grid.ClearValidationRules -1 ' Clear ALL
Methods for configuring in-cell dropdown and date picker editors.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SetColumnDropdownItems | colIndex As Long, items As Variant | Set dropdown list items for in-cell editing | |
| SetColumnDatePicker | colIndex As Long, enable As Boolean | Enable date picker for in-cell editing | |
| SetColumnDropdownEditable | colIndex As Long, editable As Boolean | Enable editable dropdown with autocomplete |
Per-Member Usage
' SetColumnDropdownItems — dropdown list for editing
m_grid.SetColumnDropdownItems 3, Array("Active", "Inactive", "Pending")
' SetColumnDatePicker — date picker for editing
m_grid.SetColumnDatePicker 4, True
Methods for creating collapsible multi-level column hierarchies.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| AddColumnGroup | title As String, childColumns As Variant, parentGroupId As Long | Long | Create a column group (0 for top-level parent) |
| RemoveColumnGroup | groupId As Long | Remove a column group | |
| CollapseColumnGroup | groupId As Long | Collapse a group (hides child columns) | |
| ExpandColumnGroup | groupId As Long | Expand a group (shows child columns) | |
| ClearColumnGroups | Remove all column groups |
Per-Member Usage
' AddColumnGroup — create a group spanning columns
Dim grp As Long
grp = m_grid.AddColumnGroup("Financial", Array(2, 3, 4), 0)
' CollapseColumnGroup / ExpandColumnGroup — toggle visibility
m_grid.CollapseColumnGroup grp ' Hides child columns
m_grid.ExpandColumnGroup grp ' Shows them again
' RemoveColumnGroup / ClearColumnGroups — cleanup
m_grid.RemoveColumnGroup grp
m_grid.ClearColumnGroups
Methods for saving and restoring column widths, order, and visibility as JSON, and properties that gate the interactive reorder and resize gestures.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| GetColumnLayout | String | Return column layout as JSON string | |
| SetColumnLayout | layout As String | Restore column layout from JSON string | |
| AllowColumnReorder | Property, R/W | Boolean | Enable drag-and-drop column reordering |
| AllowColumnResize | Property, R/W | Boolean | Enable interactive column resizing by dragging a header edge. Default True. SetColumnWidth and AutoFitColumns are unaffected. |
Remarks: AllowColumnResize gates the gesture only — the header-edge drag, the resize cursor, the double-click auto-fit on a border, and the header menu's Auto-Fit Column item (which is greyed, not removed). Programmatic sizing through SetColumnWidth, AutoFitColumns, SetColumnAutoSize and SetColumnLayout keeps working while it is False. Both AllowColumnReorder and AllowColumnResize take part in design-time property persistence.
Per-Member Usage
' GetColumnLayout / SetColumnLayout — save/restore layout
Dim layout As String: layout = m_grid.GetColumnLayout
' ... later ...
m_grid.SetColumnLayout layout
' AllowColumnReorder (Property) — drag-and-drop reordering
m_grid.AllowColumnReorder = True
' AllowColumnResize (Property) — lock the user out of dragging column edges
m_grid.AllowColumnResize = False
m_grid.SetColumnWidth 2, 120 ' still works: programmatic sizing is not gated
Properties and methods for event-driven, host-owned data supply without materializing the entire host dataset in the grid.
The grid asks for rows with the NeedRows event; the host answers with
SupplyRows. There is no data-callback object — see the retirement note below.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| DataMode | Property, R/W | Long | 0=Embedded (default), 1=Virtual, 2=Turbo column-store |
| SetVirtualRowCount | count As Long | Declare the total row count of the host's dataset. Always discards cached rows, so growing and shrinking behave identically. | |
| SupplyRows | requestId As Long, generation As Long, firstRow As Long, data As Variant | Answer a NeedRows request with a 2-dimensional Variant array. Pass Empty/Null to decline. Legal to call from inside the handler. | |
| InvalidateAllRows | Signal that the host's dataset changed: bumps the generation, discards the cache and refetches the viewport. The only invalidation method — range invalidation is deliberately not offered. | ||
| SetPrefetchMargin | rows As Long | Rows of prefetch margin either side of the viewport. Widens the requested envelope only. Default 0. | |
| PrefetchMargin | Property, R | Long | Current prefetch margin in rows, as last set by SetPrefetchMargin. Default 0. |
| GetVirtualDiagnostics | String | Virtual-mode diagnostics as a flat JSON object. | |
| FillVirtualSynthetic | Long | Development fixture. Fills every row the last paint reported missing from a deterministic in-process generator (cell text "R{row}C{col}"), no host involved. Returns the number of rows filled. | |
| SetVirtualViewportTop | topRow As Long | Development fixture. Places the viewport so topRow is the first visible row, as a scrollbar jump would. Clamped to the declared row count. |
Per-Member Usage
' DataMode (Property) — switch to virtual mode
m_grid.DataMode = 1 ' Virtual mode
' SetVirtualRowCount — total row count
m_grid.SetVirtualRowCount 1000000 ' 1 million rows
' SupplyRows — answer the grid's NeedRows request
Private Sub LiteGrid1_NeedRows(ByVal requestId As Long, ByVal generation As Long, _
ByVal firstRow As Long, ByVal lastRow As Long)
Dim data() As Variant
' ... fill data(0 To lastRow - firstRow, 0 To colCount - 1) from your source ...
m_grid.SupplyRows requestId, generation, firstRow, data
End Sub
' InvalidateAllRows — the host's dataset changed
m_grid.InvalidateAllRows
' SetPrefetchMargin / PrefetchMargin — ask for larger pages, then confirm
m_grid.SetPrefetchMargin 50
Debug.Print m_grid.PrefetchMargin ' 50
' GetVirtualDiagnostics — flat JSON counters
Debug.Print m_grid.GetVirtualDiagnostics
' FillVirtualSynthetic / SetVirtualViewportTop — development/diagnostic fixtures.
' Useful for exercising the cache without wiring a real host data source. Not
' part of a normal production integration.
m_grid.SetVirtualViewportTop 500000
Dim filled As Long: filled = m_grid.FillVirtualSynthetic
SetDataCallback (DISPID 293) is
retired and NotifyRowsChanged (DISPID 295) is withdrawn.
Both are absent from the current typelib and neither DISPID has been reassigned. Data is supplied
through the NeedRows event plus SupplyRows; invalidation is
InvalidateAllRows.FillVirtualSynthetic and SetVirtualViewportTop were built to exercise
the cache/eviction/prefetch machinery without a real host data source. They are ordinary, permanently
supported members of the v1 API surface — not a future removal candidate — but
most integrations will never call either one directly; real data comes through
NeedRows/SupplyRows as shown above.Methods for setting VBA callbacks that calculate cell values dynamically.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SetComputedColumn | colIndex As Long, callback As Object | Attach a callback object exposing GetComputedValue(colIndex, rowIndex) for computed column values | |
| ClearComputedColumn | colIndex As Long | Remove computed column callback |
Per-Member Usage
' SetComputedColumn — column 4 computed by a class instance
' (the class exposes: Function GetComputedValue(ByVal colIndex As Long, ByVal rowIndex As Long) As Variant)
Dim calc As New clsComputed
m_grid.SetComputedColumn 4, calc
' ClearComputedColumn — remove callback
m_grid.ClearComputedColumn 4
Methods for setting custom cell renderers, mapping values to status badges, and enabling the BeforeCellPaint event.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SetColumnRenderer | colIndex As Long, rendererType As Long | Set renderer: 0=Default, 1=Checkbox, 2=Progress, 3=Sparkline, 4=Button, 5=Star, 6=Pill (status badge) | |
| SetColumnPillMap | colIndex As Long, displayValue As String, pillStatus As Long | Map an exact display value to a badge status for a renderer-6 column: 0=Neutral, 1=Good, 2=Warn, 3=Bad. Good/Warn/Bad use the theme's Status_Good, Status_Warn and Status_Bad roles; an unmapped value draws the neutral badge. | |
| ClearColumnPillMap | colIndex As Long | Remove every value mapping from a column. The pill renderer stays attached, so every value then draws the neutral badge. | |
| EnableBeforeCellPaint | Property, R/W | Boolean | When True, BeforeCellPaint event fires for every cell |
Per-Member Usage
' SetColumnRenderer — custom cell renderers
m_grid.SetColumnRenderer 1, 1 ' Checkbox renderer
m_grid.SetColumnRenderer 2, 2 ' Progress bar renderer
m_grid.SetColumnRenderer 3, 4 ' Button renderer
' SetColumnPillMap — status badges on a renderer-6 column
m_grid.SetColumnRenderer 5, 6 ' Pill renderer
m_grid.SetColumnPillMap 5, "Delivered", 1 ' Good
m_grid.SetColumnPillMap 5, "On Hold", 2 ' Warn
m_grid.SetColumnPillMap 5, "Cancelled", 3 ' Bad
' EnableBeforeCellPaint (Property) — custom painting
m_grid.EnableBeforeCellPaint = True
Methods and properties for batch updates, memory optimization, and forced repaint.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| BeginUpdate | Suspend rendering for batch operations | ||
| EndUpdate | Resume rendering after batch operations | ||
| Refresh | Force an immediate repaint | ||
| CompactMode | Property, R/W | Boolean | Store display text only (reduced memory for text-only grids) |
| Compact | Release excess memory capacity | ||
| EstimateMemory | Long | Return estimated memory usage in bytes | |
| GetPaintMetrics | String | Get paint performance metrics as JSON (avg/max paint time, cache hit rate) |
Per-Member Usage
' BeginUpdate / EndUpdate — batch operations
m_grid.BeginUpdate
Dim i As Long
For i = 1 To 10000
m_grid.AddRow Array("Item " & i, i * 1.5, "Active")
Next
m_grid.EndUpdate
' Refresh — force immediate repaint
m_grid.Refresh
' CompactMode (Property) — text-only storage mode
m_grid.CompactMode = True
' Compact — release excess memory
m_grid.Compact
' EstimateMemory — check memory usage
Debug.Print "Memory: " & Format(m_grid.EstimateMemory / 1048576, "0.0") & " MB"
Read-only version properties, diagnostic tools for benchmarking and error logging, and live runtime instrumentation (DPI, paint timings, cache hit ratios) for inspector UIs and performance monitoring.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| Version | Property, R | String | Version string (e.g. "1.0.0") |
| BuildDate | Property, R | String | Build date string (e.g. "2026-03-29") |
| VersionMajor | Property, R | Long | Major version number |
| VersionMinor | Property, R | Long | Minor version number |
| VersionPatch | Property, R | Long | Patch version number |
| LastError | Property, R | String | Last error message, or empty string if no error |
| RunBenchmark | benchmarkId As Long | String | Run benchmark: 0=Load, 1=Sort, 2=Paint, 3=Memory, 4=All. Returns JSON. |
| EnableDiagnosticLog | enabled As Boolean | Enable or disable diagnostic logging | |
| GetFullDiagnosticsJSON | String | Combined diagnostics JSON: memory, paint perf, grid state | |
| HoveredRow | Property, R | Long | Currently hovered row index, or -1 if none |
| CurrentDpi | Property, R | Long | Effective DPI for the grid window (e.g. 96, 120, 144, 192) |
| PerformanceStats | Property, R | String | All engine stats as JSON: rows, icons, paint ms, cache hits, theme, DPI |
| CacheHitRatio | Property, R | Double | Geometry cache hit ratio, 0.0–1.0 |
| GeometryRebuilds | Property, R | Long | Cumulative count of icon-geometry cache rebuilds |
| AvgPaintMs | Property, R | Double | EMA-smoothed average paint time in milliseconds |
| ImageListIconCount | Property, R | Long | Number of external icons currently held by the ImageList |
| GetResolvedIcon | row As Long, col As Long | String | Inspector readback: returns kind/externalId/builtinId for the icon a cell currently shows |
Per-Member Usage
' Version / BuildDate (Properties) — version info
Debug.Print "Version: " & m_grid.Version
Debug.Print "Built: " & m_grid.BuildDate
' VersionMajor / VersionMinor / VersionPatch
Debug.Print m_grid.VersionMajor & "." & m_grid.VersionMinor & "." & m_grid.VersionPatch
' LastError (Property) — check for errors
If m_grid.LastError <> "" Then
MsgBox "Error: " & m_grid.LastError
End If
' RunBenchmark — performance test (returns JSON)
Dim results As String: results = m_grid.RunBenchmark(4)
Debug.Print results
' EnableDiagnosticLog — enable logging
m_grid.EnableDiagnosticLog True
' Runtime instrumentation — live read-only properties
Debug.Print "DPI: " & m_grid.CurrentDpi
Debug.Print "Hover row: " & m_grid.HoveredRow
Debug.Print "Avg paint: " & m_grid.AvgPaintMs & " ms"
Debug.Print "Cache hit: " & Format(m_grid.CacheHitRatio, "0.00%")
Debug.Print "Geometry rebuilds: " & m_grid.GeometryRebuilds
Debug.Print "External icons: " & m_grid.ImageListIconCount
Debug.Print m_grid.PerformanceStats ' Full JSON snapshot
' GetResolvedIcon — diagnose which rule produced a cell's icon
Dim info As String: info = m_grid.GetResolvedIcon(0, 3)
Debug.Print info ' e.g. "kind=builtin,externalId=-1,builtinId=1"
Methods for exporting grid data to PDF and XLSX formats. Both are self-contained with no external library dependencies.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| ExportToPdf | filePath As String | Export grid data to a PDF file. No external library needed. | |
| ExportToXlsx | filePath As String | Export grid data to an XLSX file (Open XML). No external library needed. |
Remarks: Both export methods preserve column widths, formatting, and filter state.
Examples
' Export to PDF
m_grid.ExportToPdf "C:\Reports\GridReport.pdf"
' Export to XLSX
m_grid.ExportToXlsx "C:\Reports\GridData.xlsx"
Methods and properties for displaying hierarchical data as an expandable/collapsible tree within the grid. Set parent-child relationships to activate tree mode.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SetTreeParent | childRow As Long, parentRow As Long | Set parent for a row. parentRow = -1 for root. Activates tree mode. | |
| GetTreeParent | row As Long | Long | Get parent row index (-1 if root) |
| GetTreeChildCount | row As Long | Long | Get number of direct children for a row |
| TreeExpand | displayRow As Long | Expand a tree node (show children) | |
| TreeCollapse | displayRow As Long | Collapse a tree node (hide children) | |
| TreeToggle | displayRow As Long | Toggle expand/collapse for a tree node | |
| TreeExpandAll | Expand all tree nodes | ||
| TreeCollapseAll | Collapse all tree nodes | ||
| ClearTreeView | Clear all parent-child relationships, return to flat mode | ||
| GetTreeDepth | displayRow As Long | Long | Get nesting depth (0 = root level) |
| IsTreeExpanded | displayRow As Long | Boolean | Check if a tree node is currently expanded |
| TreeViewActive | Property, R | Boolean | True if tree view mode is currently active |
| TreeIndent | Property, R/W | Long | Indent width in pixels per nesting level (default 16) |
Remarks: Tree nodes display with expand/collapse arrows in the first visible column. Setting any parent-child relationship via SetTreeParent activates tree mode automatically. Use ClearTreeView to return to flat mode. Arrow Left/Right keys collapse/expand the focused node. TreeIndent controls the pixel offset per nesting depth.
Examples
' Build a 3-level hierarchy: Company > Department > Employee
' Assume rows are already loaded:
' Row 0: "Acme Corp"
' Row 1: "Engineering"
' Row 2: "Alice"
' Row 3: "Bob"
' Row 4: "Sales"
' Row 5: "Carol"
' Set root node (Company)
m_grid.SetTreeParent 0, -1 ' Acme Corp is root
' Set departments as children of company
m_grid.SetTreeParent 1, 0 ' Engineering -> Acme Corp
m_grid.SetTreeParent 4, 0 ' Sales -> Acme Corp
' Set employees as children of departments
m_grid.SetTreeParent 2, 1 ' Alice -> Engineering
m_grid.SetTreeParent 3, 1 ' Bob -> Engineering
m_grid.SetTreeParent 5, 4 ' Carol -> Sales
' Set a wider indent (24 pixels per level)
m_grid.TreeIndent = 24
' Expand all nodes to show full hierarchy
m_grid.TreeExpandAll
' Check tree state
Debug.Print "Tree active: " & m_grid.TreeViewActive ' True
Debug.Print "Depth of Alice: " & m_grid.GetTreeDepth(2) ' 2
Debug.Print "Children of Acme: " & m_grid.GetTreeChildCount(0) ' 2
Debug.Print "Parent of Bob: " & m_grid.GetTreeParent(3) ' 1 (Engineering)
' Check if a node is expanded
If m_grid.IsTreeExpanded(0) Then
Debug.Print "Acme Corp is expanded"
End If
' Collapse just the Engineering department
m_grid.TreeCollapse 1
' Toggle Sales department
m_grid.TreeToggle 4
' Collapse everything
m_grid.TreeCollapseAll
' Clear tree view — return to flat grid
m_grid.ClearTreeView
Debug.Print "Tree active: " & m_grid.TreeViewActive ' False
Methods and properties for undoing and redoing cell edits, with support for grouping multiple edits into a single atomic undo step.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| Undo | Boolean | Undo last cell edit. Returns True if successful. | |
| Redo | Boolean | Redo last undone operation. Returns True if successful. | |
| CanUndo | Property, R | Boolean | True if an undo operation is available |
| CanRedo | Property, R | Boolean | True if a redo operation is available |
| ClearUndoHistory | Clear all undo/redo history | ||
| BeginUndoGroup | Begin grouping multiple edits as a single undo step | ||
| EndUndoGroup | End the current undo group |
Remarks: Only cell edits are tracked (not sort, filter, or structural changes). BeginUndoGroup/EndUndoGroup wraps multiple SetCell or SetCellValue calls into one atomic undo step. Use CanUndo/CanRedo to enable or disable toolbar buttons. ClearUndoHistory frees memory used by the undo stack.
Examples
' Simple undo/redo
m_grid.SetCellValue 0, 0, "Original"
m_grid.SetCellValue 0, 0, "Changed"
m_grid.Undo ' cell is now "Original"
m_grid.Redo ' cell is now "Changed"
' Group 3 cell edits into one undo step
m_grid.BeginUndoGroup
m_grid.SetCellValue 0, 0, "A"
m_grid.SetCellValue 1, 0, "B"
m_grid.SetCellValue 2, 0, "C"
m_grid.EndUndoGroup
' One Undo call reverts all 3 cells
m_grid.Undo
' One Redo call restores all 3 cells
m_grid.Redo
' Use CanUndo / CanRedo for toolbar state
btnUndo.Enabled = m_grid.CanUndo
btnRedo.Enabled = m_grid.CanRedo
' Clear undo history to free memory
m_grid.ClearUndoHistory
Debug.Print "CanUndo: " & m_grid.CanUndo ' False
Debug.Print "CanRedo: " & m_grid.CanRedo ' False
Methods for saving, loading, and managing named filter presets. Presets capture all column filter states for quick recall.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SaveFilterPreset | presetName As String | Save current filter state as a named preset | |
| LoadFilterPreset | presetName As String | Load and apply a previously saved filter preset | |
| DeleteFilterPreset | presetName As String | Delete a named filter preset | |
| GetFilterPresetNames | String | Get all preset names as a JSON array |
Remarks: Presets capture all column filter states including text, numeric, value-list, and range filters. Presets are stored in-memory — to persist them across sessions, save the names and use GetFilterState/SetFilterState for the actual filter data. GetFilterPresetNames returns a JSON array such as ["Sales View","Q4 Only"].
Examples
' Apply some filters, then save as a preset
m_grid.SetFilterText 0, "*Sales*"
m_grid.SetFilterNumeric 3, ">", 10000
m_grid.SaveFilterPreset "Sales View"
' Apply different filters, save another preset
m_grid.ClearAllFilters
m_grid.SetFilterText 1, "Q4*"
m_grid.SaveFilterPreset "Q4 Only"
' List all saved presets
Dim names As String
names = m_grid.GetFilterPresetNames
Debug.Print names ' ["Sales View","Q4 Only"]
' Load a preset by name
m_grid.LoadFilterPreset "Sales View"
' Delete a preset
m_grid.DeleteFilterPreset "Q4 Only"
' Verify deletion
names = m_grid.GetFilterPresetNames
Debug.Print names ' ["Sales View"]
Property and method for enabling drag-and-drop row reordering and programmatic row movement.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| AllowRowReorder | Property, R/W | Boolean | Enable drag-and-drop row reordering. Default False. |
| MoveRow | fromDisplayIndex As Long, toDisplayIndex As Long | Programmatically move a row to a new display position |
Remarks: When AllowRowReorder is True, users can Alt+Click-drag rows to reorder them. The grid fires no special event — read the new order from the display indices after reordering. MoveRow works regardless of the AllowRowReorder property value, so rows can always be moved programmatically.
Examples
' Enable drag-and-drop row reordering
m_grid.AllowRowReorder = True
' Move row at display index 5 to the top (index 0)
m_grid.MoveRow 5, 0
' Move the last row to position 2
Dim lastRow As Long
lastRow = m_grid.RowCount - 1
m_grid.MoveRow lastRow, 2
' Disable reordering when done
m_grid.AllowRowReorder = False
' Programmatic reorder still works even when drag is disabled
m_grid.MoveRow 3, 0 ' Move row 3 to top
Methods for selecting and querying rectangular cell blocks within the grid.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SelectBlock | rowStart As Long, colStart As Long, rowEnd As Long, colEnd As Long | Select a rectangular block of cells. Clears previous selection. | |
| GetBlockSelection | rowStart As Long ByRef, colStart As Long ByRef, rowEnd As Long ByRef, colEnd As Long ByRef | Boolean | Query current block selection. Returns False if no block is active. |
Remarks: Block selection is independent of row selection (SelectionMode = 0). Use SelectionMode = 1 (Cell) for cell-level operations. GetBlockSelection's four output parameters are filled via ByRef — always check the return value before reading the output parameters.
Examples
' SelectBlock — select a 10-row x 3-column block starting at row 0, col 1
m_grid.SelectBlock 0, 1, 9, 3
' GetBlockSelection — query the current block and print its bounds
Dim r1 As Long, c1 As Long, r2 As Long, c2 As Long
Dim hasBlock As Boolean
hasBlock = m_grid.GetBlockSelection(r1, c1, r2, c2)
If hasBlock Then
Debug.Print "Block: (" & r1 & "," & c1 & ") to (" & r2 & "," & c2 & ")"
Else
Debug.Print "No block selection active"
End If
Methods for serializing and restoring the complete grid layout and configuration state.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| GetGridState | String | Serialize the full grid state (column widths, visibility, order, sort, filters, scroll position, frozen panes) to a JSON string. | |
| SetGridState | json As String | Restore grid state from a JSON string previously returned by GetGridState. |
Remarks: Use for persisting user layout preferences. Store the JSON in a database field, registry key, or INI file. State includes everything the user can configure — column layout, filter state, sort order, scroll position, and frozen pane settings. Does NOT include data.
Examples
' GetGridState — capture the current layout as JSON
Dim stateJson As String
stateJson = m_grid.GetGridState()
' SetGridState — restore the layout later
m_grid.SetGridState stateJson
' Persist to a database field (example using DAO)
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT GridState FROM UserPrefs WHERE UserID=1")
If Not rs.EOF Then
rs.Edit
rs!GridState = m_grid.GetGridState()
rs.Update
End If
rs.Close
' Restore from database on form load
Dim savedState As String
savedState = DLookup("GridState", "UserPrefs", "UserID=1")
If Len(savedState) > 0 Then
m_grid.SetGridState savedState
End If
Methods for showing the built-in find panel and column visibility chooser, and the property that controls keyboard type-ahead search.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| ShowFindBar | Show the built-in Ctrl+F find panel. Programmatic equivalent of pressing Ctrl+F. | ||
| HideFindBar | Hide the find panel and return focus to the grid. | ||
| ShowColumnChooser | x As Long, y As Long | Show a column visibility chooser popup at the specified screen coordinates. Pass 0,0 for auto-position. | |
| MatchEntry | Property, R/W | Long | Type-ahead search behaviour when the grid has focus. See the LiteGridMatchEntry enum (0 = Off, 1 = FirstLetter, 2 = Complete). Default 2. |
Remarks: The find panel supports find-and-replace (Ctrl+H) with match case and whole word options. ShowColumnChooser displays a checklist of all columns — users can toggle visibility. Position 0,0 auto-centers near the mouse cursor. MatchEntry governs type-ahead, which is separate from the find panel: keystrokes search the focused column and move the focus row. Complete (2, the default and the behaviour of every earlier release) accumulates keystrokes into a prefix that resets after a short idle; FirstLetter (1) keeps only the last key, so repeating it cycles through matches; Off (0) stops keystrokes moving the focus row at all. Changing the mode discards any prefix already typed.
Examples
' ShowFindBar — open the find panel programmatically
m_grid.ShowFindBar
' HideFindBar — dismiss it and return focus to the grid
m_grid.HideFindBar
' ShowColumnChooser — auto-position (0,0)
m_grid.ShowColumnChooser 0, 0
' Typical usage: wire a toolbar button to toggle find
Private Sub btnFind_Click()
m_grid.ShowFindBar
End Sub
' MatchEntry — cycle through rows sharing a first letter
m_grid.MatchEntry = 1 ' lgMatchEntryFirstLetter
' ...or turn type-ahead off so keystrokes never move the focus row
m_grid.MatchEntry = 0 ' lgMatchEntryOff
Properties that control built-in UI elements such as menus, status bar, auto-filter row, and loading overlay, plus viewport navigation — scrolling a row into view and tuning the mouse wheel.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| ShowHeaderMenu | Property, R/W | Boolean | Show the built-in right-click context menu on column headers. Default True. Menu includes Sort, Filter, Hide Column, Auto-Fit, etc. |
| ShowStatusBar | Property, R/W | Boolean | Show a status bar below the data area. Default False. Displays selection count and aggregate metrics. |
| ShowBuiltinContextMenu | Property, R/W | Boolean | Show the built-in right-click context menu on cells. Default True. Menu includes Copy, Paste, Delete, Select All, etc. |
| ShowAutoFilterRow | Property, R/W | Boolean | Show auto-filter row with edit controls below column headers. Default False. Users type filter text directly. |
| StatusBarMetrics | Property, R/W | String | Comma-separated aggregate tokens for the status bar right section. Examples: "Count", "Sum", "Avg", "Min", "Max". |
| CheckAllVisible | colIndex As Long | Check all visible rows in a checkbox column | |
| UncheckAllVisible | colIndex As Long | Uncheck all visible rows in a checkbox column | |
| ShowLoadingOverlay | text As String | Show semi-transparent loading overlay with centered text | |
| HideLoadingOverlay | Hide the loading overlay | ||
| ScrollToView | rowIndex As Long | Scroll the minimum distance needed to bring a view row into the scrollable band. Does nothing if the row is already fully visible. | |
| WheelScrollRows | Property, R/W | Long | Rows scrolled per mouse-wheel notch. -1 = automatic (system setting), 0 = wheel scrolling disabled, n > 0 = exactly n rows. Default -1. |
Remarks: Set ShowHeaderMenu = False and handle BeforeHeaderMenu events for custom header menus. The auto-filter row provides instant text filtering — each column gets an edit box that filters as the user types. ScrollToView takes a VIEW index — the same space as GetCellValue, so it respects the current sort and filter — and raises "Row index is out of range." for an index outside that space; header, frozen rows and the aggregate footer are excluded from the band it scrolls into. WheelScrollRows = -1 honours the Windows wheel setting capped at 60px per notch, while a positive count is honoured literally with no cap.
Examples
' Enable the status bar with Sum, Avg, and Count metrics
m_grid.ShowStatusBar = True
m_grid.StatusBarMetrics = "Sum,Avg,Count"
' Enable the auto-filter row for instant text filtering
m_grid.ShowAutoFilterRow = True
' Disable both built-in menus for a custom implementation
m_grid.ShowHeaderMenu = False
m_grid.ShowBuiltinContextMenu = False
' ScrollToView — bring a row into view after locating it
m_grid.ScrollToView 500
' WheelScrollRows — three rows per notch, honoured literally
m_grid.WheelScrollRows = 3
' ...or switch the wheel off entirely
m_grid.WheelScrollRows = 0
Methods for enabling proportional data bar fills behind cell text in numeric columns.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SetColumnDataBar | colIndex As Long, enabled As Boolean | Enable or disable proportional data bar fill for a numeric column. | |
| SetDataBarColor | colIndex As Long, color As Long | Set the data bar fill color (OLE_COLOR). Default is a blue gradient. | |
| SetDataBarRange | colIndex As Long, minVal As Double, maxVal As Double | Set explicit min/max range for data bars. Overrides auto-range detection. |
Remarks: Data bars render a horizontal bar behind cell text, proportional to the cell's numeric value. By default, the range is auto-detected from the column's data. Use SetDataBarRange to set fixed bounds (e.g., 0 to 100 for percentages). Data bars work alongside heatmaps.
Examples
' Enable data bars on column 2 (Revenue)
m_grid.SetColumnDataBar 2, True
' Set a custom green color for the data bars
m_grid.SetDataBarColor 2, RGB(76, 175, 80)
' Set explicit range 0 to 100 for a percentage column
m_grid.SetColumnDataBar 4, True
m_grid.SetDataBarRange 4, 0, 100
m_grid.SetDataBarColor 4, RGB(33, 150, 243)
' Disable data bars on a column
m_grid.SetColumnDataBar 2, False
General-purpose properties and methods for controlling render style, empty state, sorting behavior, column editability, tooltips, theme customization, and per-column colors.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| RenderStyle | Property, R/W | Long | Rendering visual style. 0=Modern (default), 1=Flat (sharp edges), 2=Classic (3D beveled headers). |
| EmptyStateText | Property, R/W | String | Text displayed when the grid has no data. Default is "No data to display". |
| AutoSortOnHeaderClick | Property, R/W | Boolean | When True (default), clicking a column header automatically sorts. Set False to handle sorting manually via ColumnClick event. |
| SetColumnReadOnly | colIndex As Long, readOnly As Boolean | Mark a column as read-only. Tab navigation skips read-only columns. | |
| SetColumnTooltip | colIndex As Long, tooltipText As String | Set tooltip text for a column header | |
| ShowProgressLabel | Property, R/W | Boolean | Show percentage text on progress bar cells (default True) |
| ApplyThemeJson | json As String | Override any of the 36 color roles from a JSON object of "RoleName":"#RRGGBB" entries. All or nothing: an unknown role, a malformed color or invalid JSON raises an error and leaves the theme unchanged. Roles not named keep their colors. | |
| GetCurrentThemeJson | String | Export all 36 resolved theme colors as JSON, in the shape ApplyThemeJson accepts | |
| SetColumnBackColor | columnIndex As Long, color As OLE_COLOR | Background color for every cell in one column. &HFFFFFFFF restores the themed background. Cell colors, conditional formats and the selection still paint over it. Not drawn in Virtual mode. | |
| SetColumnForeColor | columnIndex As Long, color As OLE_COLOR | Text color for every cell in one column, checked against the background each cell actually gets. &HFFFFFFFF restores the themed text color. Not drawn in Virtual mode. | |
| ApplyColumnStylesJson | json As String | Apply per-column colors from {"columns":[{"index":2,"back":"#FFF8E1","fore":"#5D4037"}]}. An omitted color is left as it was; "auto" restores the theme. All or nothing. | |
| GetColumnStylesJson | String | Export the per-column colors in the shape ApplyColumnStylesJson accepts. Only columns carrying a color appear. |
Remarks: RenderStyle affects the entire grid appearance. SetColumnReadOnly is useful for computed/formula columns or ID columns that users should not modify.
Examples
' Set flat render style
m_grid.RenderStyle = 1 ' lgRenderFlat
' Customize the empty state message
m_grid.EmptyStateText = "No records found. Try adjusting your filters."
' Disable auto-sort for manual handling
m_grid.AutoSortOnHeaderClick = False
' Make the ID column (col 0) read-only
m_grid.SetColumnReadOnly 0, True
' Per-column colors survive a theme change; save and restore them as one string
m_grid.SetColumnBackColor 2, RGB(238, 244, 250)
savedStyles = m_grid.GetColumnStylesJson()
m_grid.ApplyColumnStylesJson savedStyles
Lightweight computed column engine. Set expressions like [Price]*[Qty] or IF([Status]='Active',[Amount],0). Column-scoped, compiled AST, O(n) evaluation. NOT an Excel formula system.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SetColumnExpression | colIndex As Long, expression As String | Set column expression. Compiled at call time. Invalid column refs fail immediately. | |
| RecalculateColumn | colIndex As Long | Recalculate a single expression column | |
| RecalculateAll | Recalculate all expression columns |
Supported functions: IF, ABS, ROUND, LEN, UPPER, LOWER, TRIM, LEFT, RIGHT, MID, MIN, MAX. Column refs: [ColumnName] (case-insensitive) or [#3] (by index). Division by zero returns NULL. Errors render as "#ERR".
Examples
' Set computed total column
m_grid.SetColumnExpression 4, "[Price]*[Qty]"
' Conditional expression
m_grid.SetColumnExpression 5, "IF([Status]='Active',[Amount],0)"
' String manipulation
m_grid.SetColumnExpression 6, "UPPER(LEFT([Name],1))"
' Recalculate after data changes
m_grid.RecalculateColumn 4
m_grid.RecalculateAll
Properties and methods for reading evaluation and license state, and for activating a purchased license.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| LicenseStatus | Property, R | String | License status string: TRIAL (evaluation window open), EXPIRED (window closed, or the copy carries no valid evaluation), EVAL, PRO, ENTERPRISE |
| LicenseState | Property, R | Long | License state: 0=Valid (activated), 1=Trial (evaluation window open), 2=Expired. 3 (Invalid) is reserved and not currently produced |
| LicenseType | Property, R | String | License type: trial, eval, pro, enterprise |
| LicenseExpiry | Property, R | Date | Expiry date: the evaluation end date signed into your copy, or an EVAL key's expiry. 0 for a perpetual license, or when the copy carries no valid evaluation |
| LicenseVersion | Property, R | String | Licensed product version string |
| TrialDaysRemaining | Property, R | Long | Whole days left in the evaluation window signed into this copy, rounded up (0 once the window has closed or a license is activated) |
| ActivateLicense | company As String, key As String | Activate a purchased license with company name and Ed25519 key. Applies to the current process only, so call it on every launch | |
| GetLicenseInfo | String | License info as JSON (schemaVersion, tier, product, company, expiryUtc, isPerpetual, daysRemaining, state). Informational only — no credential material. |
Per-Member Usage
' Check license status
Debug.Print "Status: " & m_grid.LicenseStatus
Debug.Print "Days left: " & m_grid.TrialDaysRemaining
' ActivateLicense — activate with company and key
m_grid.ActivateLicense "Acme Corp", "BASE64_ED25519_KEY_HERE"
' Verify activation
If m_grid.LicenseState = 0 Then
Debug.Print "Licensed: " & m_grid.LicenseType
End If
' GetLicenseInfo — full JSON snapshot, for a support ticket or diagnostics page
Debug.Print m_grid.GetLicenseInfo
ActivateLicense
applies to every grid instance created from the same loaded OCX file in that process, already created or
created later, but the Software stores no activation state anywhere — no registry, no file. After
the host process restarts, call ActivateLicense again before first use. See the EULA's
licensing section for the full contractual statement.ActivateLicense succeeds with a valid key.Registration-free deployment has no typelib to bind WithEvents to, so events are
delivered through a callback object instead. These 8 methods attach, configure, and diagnose that
bridge. This is the canonical reference for all 8 — events.html
covers the same members from a usage/walkthrough angle and cross-links back here rather than
duplicating the descriptions. See also
Docs/LiteGrid_VBA_Event_Wrapper.md for the shipped VBA wrapper that turns the numeric
eventId back into named events in both modes.
| Member | Parameters | Returns | Description |
|---|---|---|---|
| SetEventCallback | callbackObject As Object, gridId As Long | Attach a late-bound callback object exposing OnGridEvent(gridId, eventId, a1..a6, ByRef Cancel). gridId is echoed back verbatim on every callback — useful when one handler serves several grids. | |
| ClearEventCallback | Detach every callback route (direct and macro). Idempotent; does not touch per-event enablement. | ||
| SetEventCallbackMacro | hostApplication As Object, macroName As String, gridId As Long | Attach a macro callback invoked through Application.Run instead of a callback object, e.g. "Module1.OnGridEvent". Macro existence is checked only on first invocation. | |
| SetEventCallbackEnabled | eventId As Long, enabled As Boolean | Enable or disable delivery of one event to the callback bridge. Never affects native WithEvents delivery. Event 26 (BeforeCellPaint) cannot be enabled — see the permanent exception noted on events.html. | |
| GetEventCallbackEnabled | eventId As Long | Boolean | Query whether an event is currently delivered to the callback bridge. Tier-B events (4, 13, 22, 23, 24, 28) are off by default. |
| GetEventCallbackInfo | String | Bridge diagnostics as JSON: per-route counters, last failure, owning thread id. Never restricted, so diagnostics stay readable even after an evaluation has expired. | |
| ClearEventCallbackObject | Detach only the direct callback object, leaving a macro callback (if any) attached. Idempotent. | ||
| ClearEventCallbackMacro | Detach only the macro callback, leaving a direct callback object (if any) attached. Idempotent. |
Per-Member Usage
' SetEventCallback — attach a callback object (typically the form itself)
m_grid.SetEventCallback Me, 1
' Public Sub OnGridEvent must live on the callback object:
Public Sub OnGridEvent(ByVal gridId As Long, ByVal eventId As Long, _
ByVal a1 As Variant, ByVal a2 As Variant, _
ByVal a3 As Variant, ByVal a4 As Variant, _
ByVal a5 As Variant, ByVal a6 As Variant, _
ByRef Cancel As Boolean)
Select Case eventId
Case 2 ' ItemClick
Debug.Print "clicked row " & a1 & ", col " & a2
End Select
End Sub
' Opt in to a Tier-B high-frequency event (off by default)
m_grid.SetEventCallbackEnabled 22, True ' CellHover
Debug.Print m_grid.GetEventCallbackEnabled(22) ' True
' Macro route instead of a callback object
m_grid.SetEventCallbackMacro Application, "Module1.OnGridEvent", 1
' Diagnostics and teardown
Debug.Print m_grid.GetEventCallbackInfo
m_grid.ClearEventCallback