Results 1 to 3 of 3

Thread: MSHFlexgrid

  1. #1

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    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).]

  2. #2
    Lively Member
    Join Date
    Jun 1999
    Posts
    80

    Post

    I don't know how to do the rest but, to write things in the grid, use the TextMatrix property.

    HTH

  3. #3
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    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
  •  



Click Here to Expand Forum to Full Width