Hi All, Ive got this function that changes the width of the columns on a datagrid however i would like to change the value of col 2 (the datagrid only has two columns)
The values of what i wana change are
Null = None
1 = Type A
2 = Type B
Can any one help ? The function is below....
VB Code:
Private Sub AddCustomDataTableStyles(ByVal dstData As DataSet, ByVal dgName As DataGrid) 'Clear the table styles for the datagrid dgName.TableStyles.Clear() 'Declare local variables Dim tsTableStyle As New DataGridTableStyle Dim tcTextCol As DataGridTextBoxColumn Dim intCounter As Integer 'Map the table style to the table in the dataset tsTableStyle.MappingName = dstData.Tables(0).TableName() 'Add textbox column style for each column in the dataset For intCounter = 0 To dstData.Tables(0).Columns.Count() - 1 'Reinstantiate the text box column and set mappings and attributes tcTextCol = New DataGridTextBoxColumn tcTextCol.MappingName = dstData.Tables(0).Columns.Item(intCounter).ColumnName tcTextCol.HeaderText = dstData.Tables(0).Columns.Item(intCounter).ColumnName Select Case tcTextCol.MappingName() Case "Address" tcTextCol.Width() = 173 Case "CaseType" tcTextCol.Width() = 75 Case Else tcTextCol.Width() = 50 End Select 'Add the column to the table style tsTableStyle.GridColumnStyles.Add(tcTextCol) Next 'Add the table styles to the datagrid dgName.TableStyles.Add(tsTableStyle) End Sub




Reply With Quote