Click to See Complete Forum and Search --> : MSFlexGrid


October 6th, 1999, 09:59 AM
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.

October 6th, 1999, 02:01 PM
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.

October 6th, 1999, 03:25 PM
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?

nmd
October 7th, 1999, 09:39 AM
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.