How to change columnheader's text in datagrid ?
TIA

Re: DataGrid newbie question by Aaron

Aaron
Wed Feb 04 10:19:42 CST 2004

I do this:


'Define a new table style and it's properties
Dim ColStyle As New DataGridTableStyle()
ColStyle.MappingName = "NAME OF TABLE"
ColStyle.AlternatingBackColor = System.Drawing.Color.FromArgb
(CType(192, Byte), CType(255, Byte), CType(255, Byte))

'Then Define the DataGridTextBoxColumn for each column in your tablestyle
Dim ColAppRegion As New DataGridTextBoxColumn()
ColAppRegion.MappingName = "App_Region_CD"
ColAppRegion.HeaderText = "Region Code"
ColAppRegion.Width = 25

Dim ColAppLongTitle As New DataGridTextBoxColumn()
ColAppLongTitle.MappingName = "App_Title_Long"
ColAppLongTitle.HeaderText = "App Long Title"
ColAppLongTitle.Width = 88

Dim ColAppWorkExt As New DataGridTextBoxColumn()
ColAppWorkExt.MappingName = "App_BPhone_ext"
ColAppWorkExt.HeaderText = "Ext."
ColAppWorkExt.Width = 30

'Then add your columnstyles to your tablestyle

ColStyle.GridColumnStyles.Add(ColAppRegion)
ColStyle.GridColumnStyles.Add(ColAppLongTitle)
ColStyle.GridColumnStyles.Add(ColAppWorkExt)
'I then clear existing TableStyle, then add tablestyle to datagrid
DataGrid1.TableStyles.Clear()
DataGrid1.TableStyles.Add(ColStyle)

HTH

Aaron


"Andy" <ondrej.motl@geovap.cz> wrote in news:OSqatWz6DHA.3704
@tk2msftngp13.phx.gbl:

> How to change columnheader's text in datagrid ?
> TIA


Re: DataGrid newbie question by Andy

Andy
Wed Feb 04 10:40:50 CST 2004

Thanks, I will try it.
Andy

"Aaron" <a_benage@hotmail.com> wrote in message
news:Xns9485733D63DEDaaronjonharveycom1@207.46.248.16...
> I do this:
>
>
> 'Define a new table style and it's properties
> Dim ColStyle As New DataGridTableStyle()
> ColStyle.MappingName = "NAME OF TABLE"
> ColStyle.AlternatingBackColor = System.Drawing.Color.FromArgb
> (CType(192, Byte), CType(255, Byte), CType(255, Byte))
>
> 'Then Define the DataGridTextBoxColumn for each column in your tablestyle
> Dim ColAppRegion As New DataGridTextBoxColumn()
> ColAppRegion.MappingName = "App_Region_CD"
> ColAppRegion.HeaderText = "Region Code"
> ColAppRegion.Width = 25
>
> Dim ColAppLongTitle As New DataGridTextBoxColumn()
> ColAppLongTitle.MappingName = "App_Title_Long"
> ColAppLongTitle.HeaderText = "App Long Title"
> ColAppLongTitle.Width = 88
>
> Dim ColAppWorkExt As New DataGridTextBoxColumn()
> ColAppWorkExt.MappingName = "App_BPhone_ext"
> ColAppWorkExt.HeaderText = "Ext."
> ColAppWorkExt.Width = 30
>
> 'Then add your columnstyles to your tablestyle
>
> ColStyle.GridColumnStyles.Add(ColAppRegion)
> ColStyle.GridColumnStyles.Add(ColAppLongTitle)
> ColStyle.GridColumnStyles.Add(ColAppWorkExt)
> 'I then clear existing TableStyle, then add tablestyle to datagrid
> DataGrid1.TableStyles.Clear()
> DataGrid1.TableStyles.Add(ColStyle)
>
> HTH
>
> Aaron
>
>
> "Andy" <ondrej.motl@geovap.cz> wrote in news:OSqatWz6DHA.3704
> @tk2msftngp13.phx.gbl:
>
> > How to change columnheader's text in datagrid ?
> > TIA
>