I have a class which inherits from DataGrid and it is bound to a a DataTable.
I have defined the GridColumnStyles I want to display. Also, I have added an
"InsertCol" to my class whidh has the code below. It works great and inserts
a column in the Datagrid whereever I specify. However, it seems the code is
like using 16 pound hammer to drive a tack..is there a shorter way?
Note: v_currentTableStyle is the current TableStyle for the DataGrid display
Public Sub InsertCol(ByVal colstyle As Object, BeforeCol As Integer)
Dim i, j As Integer
Dim ts As New DataGridTableStyle
i = beforecol
j = i
While i < v_currentTableStyle.GridColumnStyles.Count
ts.GridColumnStyles.Add(v_currentTableStyle.GridCo lumnStyles(j))
v_currentTableStyle.GridColumnStyles.RemoveAt(j)
i = i + 1
End While
add_GridColumnStyle(colstyle) 'a routine that adds different colstyles
j = ts.GridColumnStyles.Count
i = 0
While i < j
v_currentTableStyle.GridColumnStyles.Add(ts.GridCo lumnStyles(i))
i = i + 1
End While
ts.Dispose()
Me.Refresh()
--
Dennis in Houston