K
Ken Powers
I have a bound datagrid that has data but the formatting from the TableStyle
is not affecting the appearence of the grid. Code below.
Private Sub BindDataGrid()
Try
dgActiveAdj.TableStyles.Clear()
dgtsAdj = New DataGridTableStyle
dgtsAdj.MappingName = "UTILITY.UtilToAdjust"
' This is a valid DataRelation of dsDataSet
With dgActiveAdj
.DataSource = dsDataSet
.DataMember = "UTILITY.UtilToAdjust"
.AllowSorting = True
End With
dgtsAdj.MappingName = "UTILITY.UtilToAdjust"
Dim grdColStyle1 As New DataGridTextBoxColumn
With grdColStyle1
.HeaderText = "Adjustment Name"
.MappingName = "UTILITY.UtilToAdjust.AdjustmentName"
dgtsAdj.GridColumnStyles.Add(grdColStyle1)
End With
grdColStyle1 = New DataGridTextBoxColumn
With grdColStyle1
.HeaderText = "Amount"
.MappingName = "UTILITY.UtilToAdjust.Adjustment"
dgtsAdj.GridColumnStyles.Add(grdColStyle1)
End With
grdColStyle1 = New DataGridTextBoxColumn
With grdColStyle1
.HeaderText = "Start Data"
.MappingName = "UTILITY.UtilToAdjust.AdjStartDate"
dgtsAdj.GridColumnStyles.Add(grdColStyle1)
End With
grdColStyle1 = New DataGridTextBoxColumn
With grdColStyle1
.HeaderText = "End Data"
.MappingName = "UTILITY.UtilToAdjust.AdjEndDate"
dgtsAdj.GridColumnStyles.Add(grdColStyle1)
End With
dgActiveAdj.TableStyles.Add(dgtsAdj)
dgActiveAdj.TableStyles(0).ReadOnly = True
Catch ex As Exception
MessageBox.Show(ex.Source.ToString & " - " & ex.Message,
Application.ProductName, _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
is not affecting the appearence of the grid. Code below.
Private Sub BindDataGrid()
Try
dgActiveAdj.TableStyles.Clear()
dgtsAdj = New DataGridTableStyle
dgtsAdj.MappingName = "UTILITY.UtilToAdjust"
' This is a valid DataRelation of dsDataSet
With dgActiveAdj
.DataSource = dsDataSet
.DataMember = "UTILITY.UtilToAdjust"
.AllowSorting = True
End With
dgtsAdj.MappingName = "UTILITY.UtilToAdjust"
Dim grdColStyle1 As New DataGridTextBoxColumn
With grdColStyle1
.HeaderText = "Adjustment Name"
.MappingName = "UTILITY.UtilToAdjust.AdjustmentName"
dgtsAdj.GridColumnStyles.Add(grdColStyle1)
End With
grdColStyle1 = New DataGridTextBoxColumn
With grdColStyle1
.HeaderText = "Amount"
.MappingName = "UTILITY.UtilToAdjust.Adjustment"
dgtsAdj.GridColumnStyles.Add(grdColStyle1)
End With
grdColStyle1 = New DataGridTextBoxColumn
With grdColStyle1
.HeaderText = "Start Data"
.MappingName = "UTILITY.UtilToAdjust.AdjStartDate"
dgtsAdj.GridColumnStyles.Add(grdColStyle1)
End With
grdColStyle1 = New DataGridTextBoxColumn
With grdColStyle1
.HeaderText = "End Data"
.MappingName = "UTILITY.UtilToAdjust.AdjEndDate"
dgtsAdj.GridColumnStyles.Add(grdColStyle1)
End With
dgActiveAdj.TableStyles.Add(dgtsAdj)
dgActiveAdj.TableStyles(0).ReadOnly = True
Catch ex As Exception
MessageBox.Show(ex.Source.ToString & " - " & ex.Message,
Application.ProductName, _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub