Hello all,

Setting the properties of the data grid during design time seems rather easy, however, I seem to be running into a brick wall attempting to set the column width, alternating backcolor, and other properties at run time.

My current code reads as follows:

'Adjust grid styles
Dim myGridStyle01 As New DataGridTableStyle

With myGridStyle01
.MappingName = "Students"
.AlternatingBackColor = Color.WhiteSmoke
.BackColor = Color.White
.GridLineStyle = DataGridLineStyle.Solid
.PreferredColumnWidth = 200
.ReadOnly = True
End With

grdStudents.TableStyles.Add(myGridStyle01)


Dim myTextCol01 As New DataGridTextBoxColumn

With myTextCol01
.MappingName = "StudentID"
.HeaderText = "Student ID"
.Width = 1000
End With

myGridStyle01.GridColumnStyles.Add(myTextCol01)

Any ideas why the alternating backcolor or width of the column names don't work?

Thanks!
Bob