ListView Problem

  • Thread starter Thread starter Hunter Kirk
  • Start date Start date
H

Hunter Kirk

I'm having a rather tedious problem with the listview control in visual
basic.net

I am trying to achive two simple procedures, I thought :)

1. I have only one column populated but still there is an extra empty column
listed to the right of the header. Is there no way to specify that I only
want a single column. Or is there a way to hide that unpopulated extra
column that I don't want.

2. How exactly does one reference the text or value of the selected sub
item. I would like to pass this text in my case to a function but I'm unable
to get it.

Sorry for the I'm sure simple questions, but I have googled my brains out
and been over the docs and can find nothing to point me in the right
direction.

Thanks in advance
 
k well I kinda hacked out a solution for hiding the column buy just setting
my single column's width to that of the list view. seems kind of a hack way
to do things, especially with resizing seems I have to update the width of
the column with the listview anytime the listview is resized. now if I can
just get that darned text from the selected subitem :)
 
To get the text of the 1st sub-item
ListView1.SelectedItems(0).SubItems(1).Text
Note that if you use a zero as the sub-items index, you will get the main
item's text,
ListView1.SelectedItems(0).SubItems(0).Text
 
hmm this still doesn't seem to help me get the text from the selected item,
is there a way to pass to this method the selected items index ?
 
Hunter, basically this is it, if you do something like
MsgBox(ListView1.SelectedItems(0).SubItems(1).Text)
then it should show, or what do you mean by sub-item? Earlier you mentioned
a single column? To get the text of the 1 column item
MsgBox(ListView1.SelectedItems(0).Text) will show the text of the 1st
selected item.
 
That did it, I was confusing myself with subitems , basically I was trying
to use a listview as a better looking listbox with the grid on and detail
view. I've got it working now, thanks for your help
 
Back
Top