lowfreq
10-09-2001, 08:24 AM
How do you change the order that the columns are displayed?
FlexGrid column orderlowfreq 10-09-2001, 08:24 AM How do you change the order that the columns are displayed? Banjo 10-09-2001, 08:33 AM You need to go through each row and swap the two column values: <pre> Public Sub SwapGridCols(grd as MSFlexGrid, COL1 as integer, COL2 as Integer) Dim i as Integer, temp As String For i = 1 To grd.Rows - 1 temp = grd.TextMatrix(i, COL1) grd.TextMatrix(i, COL1) = grd.TextMatrix(i, COL2) grd.TextMatrix(i, COL2) = temp Next i End Sub</pre> Laurent 10-09-2001, 08:34 AM if you are populating the grid from a recordset, you can try changing the select order I'll be amongst the best any minute now ! Banjo 10-09-2001, 08:36 AM What's the select order? Laurent 10-09-2001, 08:41 AM in your sql statement when you do "select field1, field2... from table" when you use a dbgrid, if you use the function that retrieve the field, it will populate the grid with the column in the same order as your statement (field1, field2...) I'll be amongst the best any minute now ! Banjo 10-09-2001, 08:47 AM Oh, got you. I was still thinking of grid properties. lowfreq 10-09-2001, 12:10 PM Worked. Thanks. Laurent 10-09-2001, 12:23 PM my pleasure! I'll be amongst the best any minute now ! |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum