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. Visual Basic
  4. Hiding columns in ListView

Hiding columns in ListView

Scheduled Pinned Locked Moved Visual Basic
csharpwinformsquestion
2 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.
  • S Offline
    S Offline
    Subha_n5
    wrote on last edited by
    #1

    Hi, I am new to vb.net and to this forum. Can anyone let me know how i can hide a listview column? I am using the standard listview control available in the windows forms. I have set the view of the listview as Details. I need to hide the first column and for that i set the width property of the first column to zero. This makes the list view column invisible during the runtime. However if i place my cursor on the listview header and drag the same, the first column appears. Is there anyway to hide the firstlistview column? Thanks in Advance Subha Subha Narayanan

    V 1 Reply Last reply
    0
    • S Subha_n5

      Hi, I am new to vb.net and to this forum. Can anyone let me know how i can hide a listview column? I am using the standard listview control available in the windows forms. I have set the view of the listview as Details. I need to hide the first column and for that i set the width property of the first column to zero. This makes the list view column invisible during the runtime. However if i place my cursor on the listview header and drag the same, the first column appears. Is there anyway to hide the firstlistview column? Thanks in Advance Subha Subha Narayanan

      V Offline
      V Offline
      Villly
      wrote on last edited by
      #2

      Hello, There is no other way to do it. You implemented is right thing. I just have a additional to tell you. Assign ColumnResize value to none means one can not resize the column. Then while filling data in ListView calculate the length of the record which you are filling currently. Then assign the record lenght value to the column width. By doing this, you will able to see full length data in your ListView without facing problem. Example for consideration: Dim iLenght as Integer ' Lenght of the record Dim iPrevMaxLength as Integer ' Length of previous record iLength = 0 iPrevMaxLength = 0 While(rs.EOF != NULL) 'Todo part ..... ..... ..... ..... iLength = len(rs.CurrentRecord) if iLength > iPrevLength then ListView.Column(index).width = iLength iPrevMaxLength = iLength end if ' Todo part ..... ..... ..... ..... Wend Let me know if this works or not. Regards, Vilas Shewale ;)

      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