ListView Control

  • Thread starter Thread starter Lou
  • Start date Start date
L

Lou

Can anyone ponit me to examples of how to use?

I have created a Listview and can add items and subItems, but how do I edit
them??

i have a ListView with 10 items, each has 5 sub items
How do I change the value of Item 2 subitem 4??
are there any "Seek" methods to find ListItems by value?

All the documentatiopn i have found is quite skim.
Even the "Examples" in the on-line help doesn't include the ListView??

-Lou
 
Lou said:
Can anyone ponit me to examples of how to use?

I have created a Listview and can add items and subItems, but how do
I edit them??

You accessthe SubItems by using the Item's SubItems collection. Fair
warning, SubItem[0] is the Item itself so always start at 1.
i have a ListView with 10 items, each has 5 sub items
How do I change the value of Item 2 subitem 4??

// Items are zero-based but actual SubItems start at index one
listView1.Items[1].SubItems[4].Text = "newValue"
are there any "Seek" methods to find ListItems by value?

Not that I know of.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
Why doesn't the intellisense work when I try your Method???

WhenI type:
ListView[
it doesn't impy there is an index
also
After typing ListView[0].
the intellisense doesn't come up with anything???

but the line of code does work as you explained???



Frank Oquendo said:
Lou said:
Can anyone ponit me to examples of how to use?

I have created a Listview and can add items and subItems, but how do
I edit them??

You accessthe SubItems by using the Item's SubItems collection. Fair
warning, SubItem[0] is the Item itself so always start at 1.
i have a ListView with 10 items, each has 5 sub items
How do I change the value of Item 2 subitem 4??

// Items are zero-based but actual SubItems start at index one
listView1.Items[1].SubItems[4].Text = "newValue"
are there any "Seek" methods to find ListItems by value?

Not that I know of.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
Lou said:
Why doesn't the intellisense work when I try your Method???

WhenI type:
ListView[
it doesn't impy there is an index
also
After typing ListView[0].

myListView.Items[0], not myListView[0].

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
Thanks Frank, I can now get the 1st col to update using
lvEvents.Items[0].SubItems[0].Text = "newValue";

BUT if I use

lvEvents.Items[0].SubItems[1].Text = "newValue";

the second column doesn't update the change??????



Frank Oquendo said:
Lou said:
Why doesn't the intellisense work when I try your Method???

WhenI type:
ListView[
it doesn't impy there is an index
also
After typing ListView[0].

myListView.Items[0], not myListView[0].

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
Lou said:
Thanks Frank, I can now get the 1st col to update using
lvEvents.Items[0].SubItems[0].Text = "newValue";

BUT if I use

lvEvents.Items[0].SubItems[1].Text = "newValue";

the second column doesn't update the change??????

Make sure you have the control's View property set to View.Details.
That's the only mode which will show columns beyond the first and the
subitems they contain.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
If I change a value
Debug.WriteLine(lvEvents.Items[0].SubItems[3].Text);

lvEvents.Items[0].SubItems[3].Text="AAAA";

Debug.WriteLine(lvEvents.Items[0].SubItems[3].Text);

it shows the change in the Debug window but NOT in the Grid??

How do I get the grid to reflect the change??

I tried "Refresh" but that didn't work?



Frank Oquendo said:
Lou said:
Why doesn't the intellisense work when I try your Method???

WhenI type:
ListView[
it doesn't impy there is an index
also
After typing ListView[0].

myListView.Items[0], not myListView[0].

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
I did have it set
//Set the type of view

lvEvents.View=View.Details;



Frank Oquendo said:
Lou said:
Thanks Frank, I can now get the 1st col to update using
lvEvents.Items[0].SubItems[0].Text = "newValue";

BUT if I use

lvEvents.Items[0].SubItems[1].Text = "newValue";

the second column doesn't update the change??????

Make sure you have the control's View property set to View.Details.
That's the only mode which will show columns beyond the first and the
subitems they contain.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
Back
Top