Dynamically Populate MSFlexGrid Control

Dynamically Populate MSFlexGrid Control

If you use an MSFlexGrid control to display data returned in an ADO recordset, you can use this code to dynamically populate the grid?including the header row?with the information in the recordset. You need an open ADO recordset named rst and a form containing an MSFlexGrid control named msfGrid:

 Dim cln As FieldWith msfGrid	.Rows = 2	.Cols = rst.Fields.Count  	'get the number of grid cols	.FixedRows = 1	.FixedCols = 0	.Row = 0	.Col = 0	For Each cln In rst.Fields		.Text = cln.Name  		'populate header row with names of fields		If .Col 


Share the Post: