W
What-a-Tool
Ended up using the following to hide unwanted columns and set the width of a
column. Now I want to re-arrange the displayed order of the columns, so I
tried creating another table style and adding the columns in the order I
wanted them, but for some reason I end up with all table style settings
gone. Anyone see what I'm doing wrong?
Thanks - Sean
'Hide un-wanted column
Me.DsGameInfo.Tables("Games").Columns("Home").ColumnMapping =
MappingType.Hidden
'Set column widths
Dim dgts As New DataGridTableStyle()
dgts.MappingName = "Games"
Me.dgGames.TableStyles.Add(dgts)
dgts.GridColumnStyles("Game").Width = 150
'Re-arrange colums
Dim dgts2 As New DataGridTableStyle()
dgts2.GridColumnStyles.Add(dgts.GridColumnStyles("Game"))
dgts2.GridColumnStyles.Add(dgts.GridColumnStyles("Home Score"))
dgts2.GridColumnStyles.Add(dgts.GridColumnStyles("Guest Score"))
dgts2.GridColumnStyles.Add(dgts.GridColumnStyles("Week / Year"))
Me.dgGames.TableStyles.Remove(dgts)
Me.dgGames.TableStyles.Add(dgts2)
Me.dgGames.Refresh()
column. Now I want to re-arrange the displayed order of the columns, so I
tried creating another table style and adding the columns in the order I
wanted them, but for some reason I end up with all table style settings
gone. Anyone see what I'm doing wrong?
Thanks - Sean
'Hide un-wanted column
Me.DsGameInfo.Tables("Games").Columns("Home").ColumnMapping =
MappingType.Hidden
'Set column widths
Dim dgts As New DataGridTableStyle()
dgts.MappingName = "Games"
Me.dgGames.TableStyles.Add(dgts)
dgts.GridColumnStyles("Game").Width = 150
'Re-arrange colums
Dim dgts2 As New DataGridTableStyle()
dgts2.GridColumnStyles.Add(dgts.GridColumnStyles("Game"))
dgts2.GridColumnStyles.Add(dgts.GridColumnStyles("Home Score"))
dgts2.GridColumnStyles.Add(dgts.GridColumnStyles("Guest Score"))
dgts2.GridColumnStyles.Add(dgts.GridColumnStyles("Week / Year"))
Me.dgGames.TableStyles.Remove(dgts)
Me.dgGames.TableStyles.Add(dgts2)
Me.dgGames.Refresh()