Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Adding a field to a ListViewItem

Adding a field to a ListViewItem

Scheduled Pinned Locked Moved .NET (Core and Framework)
questionhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paolo Ponzano
    wrote on last edited by
    #1

    Hello, I'm getting stucked at this point : I've created a new class called ListViewItemEn that inherits from ListViewItem, I need to add a String into this new class called FullPath, since this point is all ok, my problem is that I'm not able to override the constructor public ListViewItemEn(String[] text, String path) { } I should add all the string of text into subitems, but it starts adding in the 2° column Here's my code public ListViewItemEn(String[] text, String percorso) { this.FullPath = percorso; for (int i=0; i< text.Length;i++) { this.SubItems.Add(text[i]); } } How can I solve that? thanks in advance Paolo

    M 1 Reply Last reply
    0
    • P Paolo Ponzano

      Hello, I'm getting stucked at this point : I've created a new class called ListViewItemEn that inherits from ListViewItem, I need to add a String into this new class called FullPath, since this point is all ok, my problem is that I'm not able to override the constructor public ListViewItemEn(String[] text, String path) { } I should add all the string of text into subitems, but it starts adding in the 2° column Here's my code public ListViewItemEn(String[] text, String percorso) { this.FullPath = percorso; for (int i=0; i< text.Length;i++) { this.SubItems.Add(text[i]); } } How can I solve that? thanks in advance Paolo

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #2

      There already is a method that takes an array of items to initialize the LVI with. In any case, it's behaving correctly. You need to set the Text property of the base class, and the SubItems are columns 1..n Marc My website
      Latest Articles: Object Comparer String Helpers

      P 1 Reply Last reply
      0
      • M Marc Clifton

        There already is a method that takes an array of items to initialize the LVI with. In any case, it's behaving correctly. You need to set the Text property of the base class, and the SubItems are columns 1..n Marc My website
        Latest Articles: Object Comparer String Helpers

        P Offline
        P Offline
        Paolo Ponzano
        wrote on last edited by
        #3

        excuse me, what u mean for base class? System.Windows.Forms??? thanks in advance Paolo

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups