MSHFlex Grid VB 6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hemant Pathak
    Recognized Expert New Member
    • Jul 2006
    • 92

    MSHFlex Grid VB 6.0

    Hi............P rogrammers..... ......

    any one tall me how can i make the group in MSHFlexgrid or MSFlexGrid.....
    in Fixed Row Just Like

    Student | Subject
    Name RollNo DOB | A1 B1 C1 D1 E1
  • Reena83
    New Member
    • Sep 2006
    • 32

    #2
    Originally posted by Hemant Pathak
    Hi............P rogrammers..... ......

    any one tall me how can i make the group in MSHFlexgrid or MSFlexGrid.....
    in Fixed Row Just Like

    Student | Subject
    Name RollNo DOB | A1 B1 C1 D1 E1

    Dont know about fixed rows but this is how I set my flexgrid:


    'in setting up a flexgrid
    'we define the width of the columns
    'and the column headings

    Sub SetupFlex()
    Dim pstHeader As String

    pstHeader = "ISBN|Title|Aut hor|Purchase Price|Date Purchased"
    ' flxBooks.Format String = pstHeader
    ' flxBooks.ColWid th(0) = 600
    ' flxBooks.ColWid th(1) = 2500
    ' flxBooks.ColWid th(2) = 2300
    ' flxBooks.ColWid th(3) = 1300
    ' flxBooks.ColWid th(4) = 1300

    With flxBooks
    .FormatString = pstHeader
    .ColWidth(0) = 600
    .ColWidth(1) = 2500
    .ColWidth(2) = 2300
    .ColWidth(3) = 1300
    .ColWidth(4) = 1250
    End With

    End Sub

    Sub FillBooksFlex(p stCatNum As String)
    Dim pstBooksSQL As String
    Dim prsbooks As New ADODB.Recordset
    Dim pstISBN As String
    Dim pstTitle As String
    Dim pstAuthor As String
    Dim pstPPrice As String
    Dim pstPdate As String

    pstBooksSQL = "Select ISBN, Title, Author, PurchasePrice, DatePurchased " & _
    "From tblbooks " & _
    "where catnum = " & pstCatNum

    prsbooks.Open pstBooksSQL, gcnLibrary, adOpenStatic, adLockOptimisti c, adCmdText

    If prsbooks.Record Count = 0 Then
    MsgBox "There are no books in the category"
    Else
    ' Loop through prsbooks and add each line to the flexgrid
    flxBooks.Rows = 1
    Do While Not prsbooks.EOF
    pstISBN = prsbooks!ISBN & vbTab
    pstTitle = prsbooks!Title & vbTab
    pstAuthor = prsbooks!Author & vbTab
    pstPPrice = Format(prsbooks !PurchasePrice, "Currency") & vbTab
    pstPdate = prsbooks!datepu rchased
    flxBooks.AddIte m pstISBN & pstTitle & pstAuthor & pstPPrice & _
    pstPdate
    prsbooks.MoveNe xt
    Loop

    End If

    'close recordset
    prsbooks.Close
    Set prsbooks = Nothing

    End Sub



    and call it: Call SetupFlex
    Call FillBooksFlex(m rsCategories!ca tnum)

    In form Load
    Next previous buttons etc

    Comment

    • sashi
      Recognized Expert Top Contributor
      • Jun 2006
      • 1749

      #3
      Hi guys,

      Another method will be using the built-in "TextWidth" function, kindly refer to below code segment, take care..

      Code:
        TextWidth("The text goes here")

      Comment

      Working...