Results 1 to 7 of 7

Thread: clear MSFLEGRID

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,649

    clear MSFLEGRID

    The code clear all in msflexgrid from column o to the and .

    Now i need to clear all from column 1...

    How to change code?

    Code:
    Private Sub ClearFlex(pFlex As MSFlexGrid)
    
        With pFlex
            .Redraw = False
            .Row = .FixedRows
            .Col = .FixedCols
            .RowSel = .Rows - 1
            .ColSel = .Cols - 1
            .FillStyle = flexFillRepeat
            Set .CellPicture = Nothing
            .CellForeColor = False
            .Text = vbNullString
            .FillStyle = flexFillSingle
            .Col = 0
            .Redraw = True
        End With
    
    End Sub

  2. #2
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,435

    Re: clear MSFLEGRID

    This is all you need to clear the entire MSFlexgrid:

    Code:
    MSFlexGrid1.Clear
    To clear column 1 (the second column), this is all you need:

    Code:
            Dim i As Integer
            For i = 0 To MSFlexGrid1.Cols - 1
                    MSFlexGrid1.TextMatrix(i, 1) = ""
            Next i
    Sam I am (as well as Confused at times).

  3. #3
    PowerPoster
    Join Date
    Feb 2017
    Posts
    5,232

    Re: clear MSFLEGRID

    Try with:

    Quote Originally Posted by luca90 View Post
    Code:
    Private Sub ClearFlex(pFlex As MSFlexGrid)
    
        With pFlex
            .Redraw = False
            .Row = .FixedRows + 1
            .Col = .FixedCols
            .RowSel = .Rows - 1
            .ColSel = .Cols - 1
            .FillStyle = flexFillRepeat
            Set .CellPicture = Nothing
            .CellForeColor = False
            .Text = vbNullString
            .FillStyle = flexFillSingle
            .Col = 0
            .Redraw = True
        End With
    
    End Sub

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,649

    Re: clear MSFLEGRID

    Quote Originally Posted by Eduardo- View Post
    Try with:
    Tks bro!

  5. #5
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,435

    Re: clear MSFLEGRID

    Why all that code?
    Sam I am (as well as Confused at times).

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,649

    Re: clear MSFLEGRID

    Quote Originally Posted by SamOscarBrown View Post
    Why all that code?

    Not mine code...
    Have a new TIPS!

  7. #7
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,435

    Re: clear MSFLEGRID

    Just sayin'----not necessary..... .Clear does it all for you...one line (to 'empty' the entire grid).
    Then just four lines to do the second thing you asked. So simple.
    Sam I am (as well as Confused at times).

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