We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Align text in columns and only getting it in headers?

Thread ID:

Created:

Updated:

Platform:

Replies:

14254 May 23,2004 09:44 AM May 23,2004 12:15 PM Windows Forms 1
loading
Tags: GridControl
Jeff
Asked On May 23, 2004 09:44 AM

I can only align the headers with this code I can''t seem to align the data in the rest of the grid. Please help! I am trying what I have seen posted out there here is my procedure... Private Sub AddCellFormattingColumnStyles2(ByVal grid As DataGrid, ByVal handler As FormatCellEventHandler) Dim ts As DataGridTableStyle ts = New DataGridTableStyle Dim dt As DataTable dt = CType(grid.DataSource, DataTable) ts.MappingName = dt.TableName Dim j As Integer j = 0 Do While (j < dt.Columns.Count) Dim cs As DataGridFormattableTextBoxColumn cs = New DataGridFormattableTextBoxColumn(j) cs.Alignment = HorizontalAlignment.Right cs.MappingName = dt.Columns(j).ColumnName cs.HeaderText = dt.Columns(j).ColumnName ''cs.Alignment = HorizontalAlignment.Right ''cs.Width = -1 AddHandler cs.SetCellFormat, handler ts.GridColumnStyles.Add(cs) j = (j + 1) Loop grid.TableStyles.Clear() grid.TableStyles.Add(ts) Dim z As Int32 z = 0 For z = 0 To dt.Columns.Count - 1 grid.TableStyles(0).GridColumnStyles(z).ReadOnly = True Select Case z Case 0 grid.TableStyles(0).GridColumnStyles(z).Width = 250 ''grid.TableStyles(0).GridColumnStyles(z).Alignment = HorizontalAlignment.Right Case Else grid.TableStyles(0).GridColumnStyles(z).Width = 150 ''grid.TableStyles(0).GridColumnStyles(z).Alignment = HorizontalAlignment.Right End Select Next grid.TableStyles(0).AllowSorting = False grid.TableStyles(0).SelectionBackColor = System.Drawing.Color.Gold End Sub

Administrator [Syncfusion]
Replied On May 23, 2004 12:15 PM

This forum is for posts regarding our Essential Grid.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;