Results 1 to 2 of 2

Thread: Datagrid Column Header

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Posts
    13

    Datagrid Column Header

    I have a Datagrid that I'm binding a dataset to, however I need to rename a couple column Headers(template columns) at run-time, based upon user interaction..


    Datagrid1.Columns(1).HeaderText = "Heading #1"
    Datagrid1.Columns(2).HeaderText = "Heading #2"


    looks like it should work, but doesn't.

    anybody have any solutions?

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    I think you are trying to address the datagrid directly itself rather than the datagridtable style, here is an example of my own code which may help.

    Dim ts1 As New DataGridTableStyle()
    ts1.MappingName = "Properties"
    ' Add Property
    Dim o1 As New DataGridTextBoxColumn()
    o1.MappingName = "Property"
    o1.Width = 0
    ts1.GridColumnStyles.Add(o1)
    ' Add First line of Address
    Dim o2 As New DataGridTextBoxColumn()
    o2.MappingName = "Adr1"
    o2.HeaderText = " First Line of Address"
    o2.Width = 160
    o2.NullText = ""
    ts1.GridColumnStyles.Add(o2)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width