Results 1 to 5 of 5

Thread: FlexGrid.AddItem [RESOLVED]

  1. #1

    Thread Starter
    Fanatic Member JCScoobyRS's Avatar
    Join Date
    Oct 2002
    Location
    Some Mountain in Colorado
    Posts
    677

    FlexGrid.AddItem [RESOLVED]

    I'm new to FlexGrids and I'm trying to add a new row to a FlexGrid with the click of a button. Can someone help? Thanks, Jeremy
    Last edited by JCScoobyRS; Jan 28th, 2003 at 05:13 PM.
    He who listens well, speaks well.

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    VB Code:
    1. Private Sub Command1_Click()
    2.   MSFlexGrid1.AddItem ""
    3. End Sub
    If you want to populate the row, delimit the cell data with tabs - Chr(9)

  3. #3

    Thread Starter
    Fanatic Member JCScoobyRS's Avatar
    Join Date
    Oct 2002
    Location
    Some Mountain in Colorado
    Posts
    677
    Aaron,
    Let's say that I just want to add a new, blank row for learning purposes, can you modify your code to fit my needs? Thanks, Jeremy
    He who listens well, speaks well.

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    That's what the code I supplied does.

  5. #5

    Thread Starter
    Fanatic Member JCScoobyRS's Avatar
    Join Date
    Oct 2002
    Location
    Some Mountain in Colorado
    Posts
    677
    Aaron,
    Thanks. Say, let's say that I'm doing this to make my FlexGrid resize to fit the number of cells:

    Code:
    Private Sub Command1_Click()
      MSFlexGrid1.AddItem ""
      
      Dim Counter As Long
        For Counter = 1 To MSFlexGrid1.Rows - 1
        MSFlexGrid1.RowHeight(Counter) = 250
        Next
        
        Dim fwidth As Integer, fheight As Integer, f As Integer
    
        For f = 0 To MSFlexGrid1.Cols - 1
        fwidth = fwidth + MSFlexGrid1.ColWidth(f)
        Next
    
        For f = 0 To MSFlexGrid1.Rows - 1
        fheight = fheight + MSFlexGrid1.RowHeight(f)
        Next
    
        fheight = fheight + MSFlexGrid1.RowHeight(0)
    
        MSFlexGrid1.Width = fwidth
        MSFlexGrid1.Height = fheight
    End Sub
    Is there a way to make it so that once it hits a certain size it will add the row but not increase the size of the grid? This would also mean enabling the verticle scroll bar. Thanks, Jeremy
    He who listens well, speaks well.

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