Results 1 to 7 of 7

Thread: The text in a msflexgrid cell is cut off

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    38

    Question

    If the text in a msflexgrid cell is longer than the column width, my text is cutoff. I don't want to use word wrap. How can I get the column width set so my text is not cut off? And I want to have the scroll bars too.

    Thanks in advance,
    Chris.
    Chris

  2. #2
    Addicted Member curlywink's Avatar
    Join Date
    Mar 2000
    Location
    Manila, Philippines
    Posts
    141
    No other choice... use wordwrap man... :<

  3. #3
    Lively Member
    Join Date
    Aug 2000
    Posts
    125
    they make you do it manually

    Code:
    Private Sub Form_Load()
        MSFlexGrid1.ColWidth(0) = 2000
        MSFlexGrid1.ColWidth(1) = 2000
    End Sub

  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Thumbs up

    Here is a Generic routine I've put together a while back:
    Code:
    Public Sub ResizeGrid(pGrid As MSFlexGrid, pForm As Form)
        Dim intRow As Integer
        Dim intCol As Integer
        
        With pGrid
            For intCol = 0 To .Cols - 1
                For intRow = 0 To .Rows - 1
                    If .ColWidth(intCol) < pForm.TextWidth(.TextMatrix(intRow, intCol)) + 100 Then
                       .ColWidth(intCol) = pForm.TextWidth(.TextMatrix(intRow, intCol)) + 100
                    End If
                Next
            Next
        End With
    End Sub
    Then just call this routine like this:


    ResizeGrid MSFlexGrid1, Form1


  5. #5

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    38

    Question

    Surge,
    This seems to do the trick. Although it seems like it only works when the grid control is wide enough to show all the text in the cell. The col width is widened, scroll bars are added (if needed), but if the grid control is not wide enough, you still can't see all the text in the cell containing the most text. It is cut off.

    I wonder why?

    Chris.
    Chris

  6. #6
    Lively Member
    Join Date
    Feb 2000
    Posts
    81

    im trying to use a flexigrid control too

    but never used one before
    here is my code
    my SQL 7 database opens up but i dont know how to get the query result to show in my control please help me!!!
    thanks john

    Code:
    Private Sub Command1_Click()
    
    Dim dyna As Recordset
    Dim theError As Long
    Dim theid As Long
    
    
    theid = txtCandidateID
    SQL = "Select * from candidate  where candidateID = " & theid & "'"
    On Local Error Resume Next
    
    Set dyna = db.OpenRecordset(SQL, dbOpenDynaset, dbSQLPassThrough + dbSeeChanges)
    theError = Err
    On Local Error GoTo 0

  7. #7
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    After having your recordset open, you can do something like this:
    Code:
    Dim intRow As Integer
    Dim intCol As Integer
    
    With MsFlexGrid1
        dyna.MoveLast
        .Rows = dyna.RecordCount + 1
        .Cols = dyna.Fields.Count
        dyna.MoveFirst
        
        'Initialize row position
        'We have to start with row 1, because row 0 is the header
        intRow = 1
        Do Until dyna.EOF
            For intCol = 0 To dyna.Fields.Count - 1
                'take care of headers
                If intRow = 1 then
                    .TextMatrix(0, intCol) = dyna.Fields(intCol).Name
                End If
    
                .TextMatrix(intRow, intCol) = dyna(intCol).Value
            Next
            intRow = intRow + 1
            dyna.MoveNext
        Loop
    End With

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