Modifying Columns in Datagrid

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top