Could not get the ColumnHeader.Name?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?WVhR?=

    #1

    Could not get the ColumnHeader.Name?

    I have set the names of each column on design-time, but the code below could
    not get their names, why? thank you.

    ////////////////////////////////////////////////////////////////////////
    For Each EachColumnHeade r As ColumnHeader In ListView1.Colum ns
    MessageBox.Show (EachColumnHead er.Name)
    Next
  • Michael C

    #2
    Re: Could not get the ColumnHeader.Na me?

    "YXQ" <YXQ@discussion s.microsoft.com wrote in message
    news:6C99510B-465F-454A-8F81-9FB315194ED0@mi crosoft.com...
    >I have set the names of each column on design-time, but the code below
    >could
    not get their names, why? thank you.
    >
    ////////////////////////////////////////////////////////////////////////
    For Each EachColumnHeade r As ColumnHeader In ListView1.Colum ns
    MessageBox.Show (EachColumnHead er.Name)
    Next
    Did you use databinding which removed the columns?


    Comment

    • Clive Lumb

      #3
      Re: Could not get the ColumnHeader.Na me?


      "YXQ" <YXQ@discussion s.microsoft.com a écrit dans le message de news:
      6C99510B-465F-454A-8F81-9FB315194ED0@mi crosoft.com...
      >I have set the names of each column on design-time, but the code below
      >could
      not get their names, why? thank you.
      >
      ////////////////////////////////////////////////////////////////////////
      For Each EachColumnHeade r As ColumnHeader In ListView1.Colum ns
      MessageBox.Show (EachColumnHead er.Name)
      Next
      Strangely it would appear that column header names defined at design time
      are not accessible at run-time.
      However if you do this
      dim header1 as columnheader
      header1= new columnheader
      header1.text ="My Title"
      header1.name="M yColumn1"
      listview1.colum ns.add(header1)

      then the name is accessible


      Comment

      • =?Utf-8?B?WVhR?=

        #4
        Re: Could not get the ColumnHeader.Na me?

        Thank you, i used the tag property.

        "Clive Lumb" wrote:
        >
        "YXQ" <YXQ@discussion s.microsoft.com a écrit dans le message de news:
        6C99510B-465F-454A-8F81-9FB315194ED0@mi crosoft.com...
        I have set the names of each column on design-time, but the code below
        could
        not get their names, why? thank you.

        ////////////////////////////////////////////////////////////////////////
        For Each EachColumnHeade r As ColumnHeader In ListView1.Colum ns
        MessageBox.Show (EachColumnHead er.Name)
        Next
        >
        Strangely it would appear that column header names defined at design time
        are not accessible at run-time.
        However if you do this
        dim header1 as columnheader
        header1= new columnheader
        header1.text ="My Title"
        header1.name="M yColumn1"
        listview1.colum ns.add(header1)
        >
        then the name is accessible
        >
        >
        >

        Comment

        Working...