Results 1 to 5 of 5

Thread: Msflexgrid( add a row)

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    208

    Msflexgrid( add a row)

    Hi,
    I have a msflexgrid which has 10 rows of data in it.
    Now I want to add a blank row before the 5th row of data
    How do I do it.

    If I use
    msflexgrid.rows= msflexgrid.rows+1
    This adds a Row BUT ONLY AT the end of the Msflexgrid.

    I want a blank row before the 5th row of data ??
    Anybody help me

    thnks
    A Student

  2. #2

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    VB Code:
    1. Public Sub InsertRow(msf As MSFlexGrid, row As Integer)
    2.  
    3.     Dim intRow As Integer
    4.     Dim intCol As Integer
    5.    
    6.     ' Move the rows down
    7.     For intRow = MSFlexGrid1.Rows - 1 To row Step -1
    8.         For intCol = 0 To MSFlexGrid1.Cols - 1
    9.             MSFlexGrid1.TextMatrix(intRow, intCol) = MSFlexGrid1.TextMatrix(intRow - 1, intCol)
    10.         Next
    11.     Next
    12.    
    13.     ' Blank the row
    14.     For intCol = 0 To MSFlexGrid1.Cols - 1
    15.         MSFlexGrid1.TextMatrix(row, intCol) = ""
    16.     Next
    17.    
    18. End Sub

    Usage:
    InsertRow MSFlexGrid1, 5

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    The AddItem method creates a new row. It has an Index parameter that lets you specify were to add the row.

    FlexGrid.AddItem "",5

  5. #5

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