G
Gary
I want to change the layout of columns in a datagrid. I
want to change the heading and the width of columns. In
the Load Event on the form, I have the following code:
Dim tsNotes As New DataGridTableStyle
tsNotes.MappingName = "Notes"
Dim cstDate As New DataGridTextBoxColumn
cstDate.MappingName = "NoteDate"
cstDate.HeaderText = "Note Date"
cstDate.Width = 1650
Dim cstStartTime As New DataGridTextBoxColumn
cstStartTime.MappingName = "StartTime"
cstStartTime.HeaderText = "Start Time"
cstStartTime.Width = 1550
Dim cstEndTime As New DataGridTextBoxColumn
cstEndTime.MappingName = "EndTime"
cstEndTime.HeaderText = "End Time"
cstEndTime.Width = 1550
tsNotes.GridColumnStyles.Add(cstDate)
tsNotes.GridColumnStyles.Add(cstStartTime)
tsNotes.GridColumnStyles.Add(cstEndTime)
Me.DG_Notes.TableStyles.Add(tsNotes)
But when I run this code, I can see no columns at all.
If I change themapping name from "Notes" to "PNotes",
these styles do not get applied. If I leave it
at "Notes" I can't see any columns. What am I doing
wrong?
Any help would be appreciated.
Thanks in advance,
Gary
want to change the heading and the width of columns. In
the Load Event on the form, I have the following code:
Dim tsNotes As New DataGridTableStyle
tsNotes.MappingName = "Notes"
Dim cstDate As New DataGridTextBoxColumn
cstDate.MappingName = "NoteDate"
cstDate.HeaderText = "Note Date"
cstDate.Width = 1650
Dim cstStartTime As New DataGridTextBoxColumn
cstStartTime.MappingName = "StartTime"
cstStartTime.HeaderText = "Start Time"
cstStartTime.Width = 1550
Dim cstEndTime As New DataGridTextBoxColumn
cstEndTime.MappingName = "EndTime"
cstEndTime.HeaderText = "End Time"
cstEndTime.Width = 1550
tsNotes.GridColumnStyles.Add(cstDate)
tsNotes.GridColumnStyles.Add(cstStartTime)
tsNotes.GridColumnStyles.Add(cstEndTime)
Me.DG_Notes.TableStyles.Add(tsNotes)
But when I run this code, I can see no columns at all.
If I change themapping name from "Notes" to "PNotes",
these styles do not get applied. If I leave it
at "Notes" I can't see any columns. What am I doing
wrong?
Any help would be appreciated.
Thanks in advance,
Gary