|
-
Jan 24th, 2000, 09:05 AM
#1
Thread Starter
Hyperactive Member
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).]
-
Jan 24th, 2000, 12:48 PM
#2
Lively Member
I don't know how to do the rest but, to write things in the grid, use the TextMatrix property.
HTH
-
Jan 24th, 2000, 12:56 PM
#3
Hyperactive Member
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).]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|