>> >> Public Sub SetGridTableStyles() >> >> ' This is a sample that will display 3 columns in a grid with the defined properties >> ' set. >> >> ' Int Table Style object >> Dim tsTableStyle As New DataGridTableStyle >> ' Set the name of the table to map to the style. >> tsTableStyle.MappingName = "Mail" >> >> >> ' For Each Column you want to display in the grid Init and >> ' set properties for a GridColumnStyle object. >> >> ' Note there are other properties you can set >> Dim Col1 As New DataGridTextBoxColumn >> Col1.MappingName = "M_From" ' Name of column to display >> Col1.HeaderText = "From" ' Header >> Col1.Width = 50 >> ' Add this column to the table style object tsTableStyle >> tsTableStyle.GridColumnStyles.Add(Col1) >> >> Dim col2 As New DataGridTextBoxColumn >> col2.MappingName = "m_CoName" ' Name of column to display >> col2.HeaderText = "Name Addressed To" ' header >> col2.Width = 145 >> tsTableStyle.GridColumnStyles.Add(col2) >> >> ' Note there is a .Net framework style class for a check box. Only textbox and check box >> ' are natively supported in .Net for now anyway. >> 'Example for checkbox >> Dim Col3 As New DataGridBoolColumn >> >> Col3.MappingName = "m_nocharg" >> Col3.HeaderText = "NC" >> Col3.Width = 20 >> Col3.AllowNull = False >> tsTableStyle.GridColumnStyles.Add(Col3) >> >> >> ' Add the table style to the Grid >> Me.grdNameOfGrid.TableStyles.Clear() >> Me.grdNameOfGrid.TableStyles.Add(tsTableStyle) >> >>