N
Nathan
Hi,
I'm trying to add column styles to a datagrid--first time I've done this in
code. I have a datagrid and have added a new table style to it in the
designer. I've set the tablestyle's mapping name to the name of my dataset
table. Then this is my code for adding columns:
With dgdInventory.TableStyles.Item(0).GridColumnStyles
Dim colIsAP As New DataGridBoolColumn()
With colIsAP
.Alignment = HorizontalAlignment.Center
.HeaderText = "A/P"
.Width = 40
.MappingName = "IsActivityPac"
.ReadOnly = True
.NullText = ""
End With
.Add(colIsAP)
Dim colItemNumber As New DataGridTextBoxColumn()
With colItemNumber
.Alignment = HorizontalAlignment.Left
.HeaderText = "Item #"
.Width = 75
.MappingName = "ItemNumber"
.NullText = ""
End With
.Add(colItemNumber)
Dim colItemDescription As New DataGridTextBoxColumn()
With colItemNumber
.Alignment = HorizontalAlignment.Left
.HeaderText = "Description"
.Width = 200
.MappingName = "ItemDescription"
.NullText = ""
End With
.Add(colItemDescription)
End With
.... and so on: I have seven columns that are set up this way. When I load
the form, only the first and last columns show up, no matter what order I
add them. I can successfully do this through the designer, but is something
wrong with my code?
Thanks,
Nathan
I'm trying to add column styles to a datagrid--first time I've done this in
code. I have a datagrid and have added a new table style to it in the
designer. I've set the tablestyle's mapping name to the name of my dataset
table. Then this is my code for adding columns:
With dgdInventory.TableStyles.Item(0).GridColumnStyles
Dim colIsAP As New DataGridBoolColumn()
With colIsAP
.Alignment = HorizontalAlignment.Center
.HeaderText = "A/P"
.Width = 40
.MappingName = "IsActivityPac"
.ReadOnly = True
.NullText = ""
End With
.Add(colIsAP)
Dim colItemNumber As New DataGridTextBoxColumn()
With colItemNumber
.Alignment = HorizontalAlignment.Left
.HeaderText = "Item #"
.Width = 75
.MappingName = "ItemNumber"
.NullText = ""
End With
.Add(colItemNumber)
Dim colItemDescription As New DataGridTextBoxColumn()
With colItemNumber
.Alignment = HorizontalAlignment.Left
.HeaderText = "Description"
.Width = 200
.MappingName = "ItemDescription"
.NullText = ""
End With
.Add(colItemDescription)
End With
.... and so on: I have seven columns that are set up this way. When I load
the form, only the first and last columns show up, no matter what order I
add them. I can successfully do this through the designer, but is something
wrong with my code?
Thanks,
Nathan