Public Sub gridLayout(ByVal dt As DataTable)
grdNextActioner.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize
grdNextActioner.RowHeadersDefaultCellStyle.BackColor = Color.Blue
Dim columnHeaderStyle As DataGridViewCellStyle = New DataGridViewCellStyle
columnHeaderStyle.Font = New Font("Verdana", 8, FontStyle.Bold)
columnHeaderStyle.BackColor = Color.Blue
grdNextActioner.ColumnHeadersDefaultCellStyle = columnHeaderStyle
grdNextActioner.DataSource = dt.DefaultView
'grdNextActioner.Sort(grdNextActioner.Columns(strAssociationBy), ListSortDirection.Descending)
Dim rowCount As Integer = grdNextActioner.Rows.Count
'DataTable dtResultCopy = dt.Clone();
Dim cellwidth As Integer = ((grdNextActioner.Width _
- (grdNextActioner.TopLeftHeaderCell.Size.Width - 20)) _
/ grdNextActioner.Columns.Count)
Dim i As Integer = 0
For Each dtc As DataColumn In dt.Columns
grdNextActioner.Columns(i).Name = dtc.ColumnName
grdNextActioner.Columns(i).HeaderText = dtc.ColumnName
grdNextActioner.Columns(i).DataPropertyName = dtc.ColumnName
grdNextActioner.Columns(i).ReadOnly = True
grdNextActioner.Columns(i).Width = cellwidth
i = (i + 1)
Next
grdNextActioner.TopLeftHeaderCell.Value = Nothing
grdNextActioner.SelectionMode = DataGridViewSelectionMode.FullRowSelect
'grdNextActioner.RowHeadersWidth = (grdNextActioner.Width - grdNextActioner.TopLeftHeaderCell.Size.Width) / grdNextActioner.Columns.Count;
Me.grdNextActioner.RowsDefaultCellStyle.BackColor = Color.Wheat
Me.grdNextActioner.AlternatingRowsDefaultCellStyle.BackColor = Color.MistyRose
' Me.grdNextActioner.Rows(grdNextActioner.Rows.Count - 1).visible = False
End Sub
No comments:
Post a Comment