I have added programmatically some columns of a dataset in a datagrid. Although i tried to change the back color of a specific column in my datagrid this was not possible. I couldnt find any attribute or method for that purpose.
My code:
dim t As New DataGridTableStyle
Dim c As DataGridTextBoxColumn
t.MappingName = " .... "
columnnames("rccharat", "Charge Rate")
t.GridColumnStyles.Add(c)
columnnames("rctaxtot", "Amount of Charge")
t.GridColumnStyles.Add(c)
....
DataGrid1.TableStyles.Add(t)
And the columnnames sub is:
Sub columnnames(ByVal truename As String, ByVal colname As String)
c = New DataGridTextBoxColumn
c.MappingName = truename
c.HeaderText = colname
c.Width = 100
c.Alignment = HorizontalAlignment.Center
End Sub
Does anyone knows if this possible?
Thank you,
My code:
dim t As New DataGridTableStyle
Dim c As DataGridTextBoxColumn
t.MappingName = " .... "
columnnames("rccharat", "Charge Rate")
t.GridColumnStyles.Add(c)
columnnames("rctaxtot", "Amount of Charge")
t.GridColumnStyles.Add(c)
....
DataGrid1.TableStyles.Add(t)
And the columnnames sub is:
Sub columnnames(ByVal truename As String, ByVal colname As String)
c = New DataGridTextBoxColumn
c.MappingName = truename
c.HeaderText = colname
c.Width = 100
c.Alignment = HorizontalAlignment.Center
End Sub
Does anyone knows if this possible?
Thank you,