At a complete loss as to how to add titles to the columns in a MSFlexGrid control. Any help for this beginner would be appreciated.
Printable View
At a complete loss as to how to add titles to the columns in a MSFlexGrid control. Any help for this beginner would be appreciated.
is the 'title' mean Column heading? if so,
Dim strDBField() As String
Dim iCount As Integer
ReDim strDBField(3)
strDBField(0) = "Month" 'name of the fields.
strDBField(1) = "Total Amount"
' Create number of columns to equal, at least, number of fields.
If flexgrid.Cols < UBound(strDBField, 1) + 1 Then
flexgrid.Cols = UBound(strDBField, 1) + 1
End If
' Populate grid header with field names.
For iCount = 0 To UBound(strDBField, 1)
flexgrid.TextMatrix(0, iCount) = strDBField(iCount)
Next
Hope this helps.
Bill.
Thanks for your help Bill; works great!
Except your code leaves me with one unlabeled column at the end. How would I get rid of that?
I am sorry. you have to change ReDim strDBField(3) to ReDim strDBField(1) i.e, '1' less than the total no of fields. also in propertypages Generel tab change the cols to 2.
Bill.