PDA

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


Gimpster
Jan 24th, 2000, 08:05 AM
Can someone explain to me the basics of how to use a MSHFlexgrid? I've read the MSDN files on it, and they are really confusing. I need to know how to

add column headers
set their captions
add text to the cells
set cell width.

If you could just give me one example of each, I would really appreciate it. Thanks.

------------------
Ryan

[This message has been edited by Gimpster (edited 01-24-2000).]

cedx
Jan 24th, 2000, 11:48 AM
I don't know how to do the rest but, to write things in the grid, use the TextMatrix property.

HTH

LG
Jan 24th, 2000, 11:56 AM
Hi, Ryan.
There is an example how to use MSFlexGrid:

Private Sub Form_Load()

Dim db As Database
Dim rs As Recordset
Dim strSQL As String
Dim i As Integer
Dim intRow As Integer
Dim intCol As Integer

Set db = OpenDatabase("Nwind.mdb")
strSQL = "select customerID,CompanyName,Address from customers"
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
If rs.EOF And rs.BOF Then Exit Sub
rs.MoveLast

MSFlexGrid1.Rows = rs.RecordCount + 1
MSFlexGrid1.Cols = rs.Fields.Count
rs.MoveFirst
intRow = 1

Do Until rs.EOF
For i = 0 To rs.Fields.Count - 1

MSFlexGrid1.TextMatrix(0, i) = rs.Fields(i).Name

MSFlexGrid1.TextMatrix(intRow, i) = LTrim(rs.Fields(i).Value) & "" 'or Format(rs.Fields(i).Value) if rs has Null value

Next

rs.MoveNext
intRow = intRow + 1

Loop
End Sub

Larisa

[This message has been edited by LG (edited 01-25-2000).]