topmade Posted June 20, 2003 Posted June 20, 2003 I was wondering if anyone knows how to insert text or data into the row header of a datagrid? iAny help would be great. Thanks in advnace!:) Topmade Quote
Moderators Robby Posted June 20, 2003 Moderators Posted June 20, 2003 something like this... Dim dgStyle As New DataGridTableStyle() With dgStyle .AlternatingBackColor = Color.LightGray .BackColor = Color.WhiteSmoke .ForeColor = Color.MidnightBlue .GridLineColor = Color.Honeydew .HeaderBackColor = Color.MidnightBlue .HeaderFont = New Font("Arial", 8.0!, FontStyle.Bold) .HeaderForeColor = Color.White .LinkColor = Color.Teal .MappingName = "Appointments" .SelectionBackColor = Color.Yellow .SelectionForeColor = Color.DarkMagenta End With Dim grd As New DataGridTextBoxColumn() With grd .HeaderText = "Some title" .MappingName = "myFieldName" .Alignment = HorizontalAlignment.Center .Width = 45 End With dgStyle.GridColumnStyles.AddRange(New DataGridColumnStyle() {grd}) DataGrid1.TableStyles.Add(dgStyle) Quote Visit...Bassic Software
topmade Posted June 21, 2003 Author Posted June 21, 2003 I still can't get it to work. I'm bindng it to a dataset, does this have anything to do with it? What am I doing wrong? Dim CN As New OleDb.OleDbConnection(strPath) CN.Open() 'DataAdapter Dim DA As New OleDb.OleDbDataAdapter _ ("Select * from Users ", CN) 'Dataset Dim DS As New DataSet() 'Fill DataAdapter DA.Fill(DS, "Users") 'Hide a column DS.Tables("Users").Columns("UserId").ColumnMapping = MappingType.Hidden Dim my As New System.Data.DataTable() 'Change a column name 'DS.Tables("Users").Rows(1) DS.Tables("Users").Columns("City").ColumnName = "Expense Type" Dim dgStyle As New DataGridTableStyle() With dgStyle .AlternatingBackColor = Color.LightGray .BackColor = Color.WhiteSmoke .ForeColor = Color.MidnightBlue .GridLineColor = Color.Honeydew .HeaderBackColor = Color.MidnightBlue .HeaderFont = New Font("Arial", 8.0!, FontStyle.Bold) .HeaderForeColor = Color.White .LinkColor = Color.Teal .MappingName = "UserNamerr" .SelectionBackColor = Color.Yellow .SelectionForeColor = Color.DarkMagenta End With Dim grd As New DataGridTextBoxColumn() With grd .HeaderText = "ydghdgfhdgf" .MappingName = "UserNamegdh" .Alignment = HorizontalAlignment.Center .Width = 45 End With 'Bind data to DataGrid DataGrid1.SetDataBinding(DS, "Users") dgStyle.GridColumnStyles.AddRange(New DataGridColumnStyle() {grd}) DataGrid1.TableStyles.Add(dgStyle) Topmade Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.