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
Printable View
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
If you want to populate the row, delimit the cell data with tabs - Chr(9)VB Code:
Private Sub Command1_Click() MSFlexGrid1.AddItem "" End Sub
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
That's what the code I supplied does.
Aaron,
Thanks. Say, let's say that I'm doing this to make my FlexGrid resize to fit the number of cells:
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, JeremyCode: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