4

I need to add items to a List View in Windows forms applications, but I need these items to be added only vertically, I tried all the View Modes, but the items keep adding bothe vertically and horizentally,

Thanks

Hassan Mokdad
  • 5,832
  • 18
  • 55
  • 90

2 Answers2

6

did you try Details view? i think only at that view mode the items are inserted vertically, line by line

NirMH
  • 4,769
  • 3
  • 44
  • 69
  • I tried the Details view, and now all the items are verticaly inserted, but they are all trimmed, only the first characters are displayed for each word, wit three dots at the end! – Hassan Mokdad Aug 05 '11 at 06:43
  • 2
    You just need to set the width of the column. Apparently -1 will set it to auto size to the widest item in the column...I did not know that ;-) http://stackoverflow.com/questions/1257500/c-listview-column-width-auto – IanR Aug 05 '11 at 08:26
  • Thanks NirMH and LandR, it worked perfectly, just one more thing, is there a way to make the long items wrap to a new line, instead of showing a horizontal scroll bar, Thanks – Hassan Mokdad Aug 06 '11 at 06:30
  • @Hassan: i'm not sure, the details view works like windows explorer, therefore if you don't wrap it yourself (calc the length of each string and chop it into two or more lines), the control supports endless horizontal bar – NirMH Aug 07 '11 at 05:30
0

Maybe a ListBox might be better suited for what you need?

IanR
  • 4,703
  • 3
  • 29
  • 27