|
-
December 1st, 2003, 11:49 PM
#1
How to set properties of the data grid at run time?
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|