473,385 Members | 1,615 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

remove a items that's been selected from a listview

How do I remove a item that's been selected from a listview?

I'm using Visual Basic 2005 express edition. Thanks

Jun 20 '06 #1
7 2012
Hello Mike,

Try ListBox.Items.*

MJ> How do I remove a item that's been selected from a listview?
MJ>
MJ> I'm using Visual Basic 2005 express edition. Thanks
MJ>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jun 20 '06 #2
Not Using a ListBox. Using a ListView

"Michael Nemtsev" wrote:
Hello Mike,

Try ListBox.Items.*

MJ> How do I remove a item that's been selected from a listview?
MJ>
MJ> I'm using Visual Basic 2005 express edition. Thanks
MJ>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Jun 20 '06 #3
Hello Mike,

The same.

listView1.Items.Remove(listView1.SelectedItems[0]); - removes first item

MJ> Not Using a ListBox. Using a ListView
MJ>
MJ> "Michael Nemtsev" wrote:
MJ>
Hello Mike,

Try ListBox.Items.*

MJ> How do I remove a item that's been selected from a listview?
MJ>
MJ> I'm using Visual Basic 2005 express edition. Thanks
MJ>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents
do not cease to be insipid." (c) Friedrich Nietzsche

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jun 20 '06 #4
What if I don't know the item by an index number? I want to be able to remove
the item that's been selected from the list. Will I need to step through the
items and check to see it it's been selected?

"Michael Nemtsev" wrote:
Hello Mike,

The same.

listView1.Items.Remove(listView1.SelectedItems[0]); - removes first item

MJ> Not Using a ListBox. Using a ListView
MJ>
MJ> "Michael Nemtsev" wrote:
MJ>
Hello Mike,

Try ListBox.Items.*

MJ> How do I remove a item that's been selected from a listview?
MJ>
MJ> I'm using Visual Basic 2005 express edition. Thanks
MJ>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents
do not cease to be insipid." (c) Friedrich Nietzsche

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Jun 20 '06 #5
Hello Mike,

Yep. Did you look at MSDN for the listView1.SelectedItems method?

They use the same approach there

ListView.SelectedListViewItemCollection breakfast = this.ListView1.SelectedItems;

double price = 0.0;
foreach ( ListViewItem item in breakfast )
{
price += Double.Parse(item.SubItems[1].Text);
}

// Output the price to TextBox1.
TextBox1.Text = price.ToString();

MJ> What if I don't know the item by an index number? I want to be able
MJ> to remove the item that's been selected from the list. Will I need
MJ> to step through the items and check to see it it's been selected?
MJ>
MJ> "Michael Nemtsev" wrote:
MJ>
Hello Mike,

The same.

listView1.Items.Remove(listView1.SelectedItems[0]); - removes first
item

MJ> Not Using a ListBox. Using a ListView
MJ>
MJ> "Michael Nemtsev" wrote:
MJ>
Hello Mike,

Try ListBox.Items.*

MJ> How do I remove a item that's been selected from a listview?
MJ>
MJ> I'm using Visual Basic 2005 express edition. Thanks
MJ>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its
opponents
do not cease to be insipid." (c) Friedrich Nietzsche

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents
do not cease to be insipid." (c) Friedrich Nietzsche

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jun 20 '06 #6
Yes I did, but was hoping for a better way. Thanks for your help.

"Michael Nemtsev" wrote:
Hello Mike,

Yep. Did you look at MSDN for the listView1.SelectedItems method?

They use the same approach there

ListView.SelectedListViewItemCollection breakfast = this.ListView1.SelectedItems;

double price = 0.0;
foreach ( ListViewItem item in breakfast )
{
price += Double.Parse(item.SubItems[1].Text);
}

// Output the price to TextBox1.
TextBox1.Text = price.ToString();

MJ> What if I don't know the item by an index number? I want to be able
MJ> to remove the item that's been selected from the list. Will I need
MJ> to step through the items and check to see it it's been selected?
MJ>
MJ> "Michael Nemtsev" wrote:
MJ>
Hello Mike,

The same.

listView1.Items.Remove(listView1.SelectedItems[0]); - removes first
item

MJ> Not Using a ListBox. Using a ListView
MJ>
MJ> "Michael Nemtsev" wrote:
MJ>
> Hello Mike,
>
> Try ListBox.Items.*
>
> MJ> How do I remove a item that's been selected from a listview?
> MJ>
> MJ> I'm using Visual Basic 2005 express edition. Thanks
> MJ>
> ---
> WBR,
> Michael Nemtsev :: blog: http://spaces.msn.com/laflour
> "At times one remains faithful to a cause only because its
> opponents
> do not cease to be insipid." (c) Friedrich Nietzsche
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents
do not cease to be insipid." (c) Friedrich Nietzsche

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Jun 20 '06 #7
Hello Mike,

Trully speaking it's a bit annoing :) but rather normal

MJ> Yes I did, but was hoping for a better way. Thanks for your help.
MJ>
MJ> "Michael Nemtsev" wrote:
MJ>
Hello Mike,

Yep. Did you look at MSDN for the listView1.SelectedItems method?

They use the same approach there

ListView.SelectedListViewItemCollection breakfast =
this.ListView1.SelectedItems;

double price = 0.0;
foreach ( ListViewItem item in breakfast )
{
price += Double.Parse(item.SubItems[1].Text);
}
// Output the price to TextBox1.
TextBox1.Text = price.ToString();
MJ> What if I don't know the item by an index number? I want to be
able
MJ> to remove the item that's been selected from the list. Will I
need
MJ> to step through the items and check to see it it's been selected?
MJ>
MJ> "Michael Nemtsev" wrote:
MJ>
Hello Mike,

The same.

listView1.Items.Remove(listView1.SelectedItems[0]); - removes first
item

MJ> Not Using a ListBox. Using a ListView
MJ>
MJ> "Michael Nemtsev" wrote:
MJ>
>> Hello Mike,
>>
>> Try ListBox.Items.*
>>
>> MJ> How do I remove a item that's been selected from a listview?
>> MJ>
>> MJ> I'm using Visual Basic 2005 express edition. Thanks
>> MJ>
>> ---
>> WBR,
>> Michael Nemtsev :: blog: http://spaces.msn.com/laflour
>> "At times one remains faithful to a cause only because its
>> opponents
>> do not cease to be insipid." (c) Friedrich Nietzsche
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its
opponents
do not cease to be insipid." (c) Friedrich Nietzsche

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents
do not cease to be insipid." (c) Friedrich Nietzsche

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jun 20 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: GTi | last post by:
I have a listview that with selected items. But I want to "reselect" items after a refresh. Each items have a uniqe value in the Tag object. After a refresh some new items may be added or removed...
7
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I'v been struggeling with removing selected items from a listview. Anyone that can give me a piece of code that does this? I am a newbee to this C# and cant figure it out.... Regards...
21
by: StriderBob | last post by:
Situation : FormX is mdi child form containing 2 ListViews ListView1 contains a list of table names and 4 sub items with data about each table. ListView2 contains a list of the columns on each...
2
by: Mamatha | last post by:
Hi I have an application with listview.When i click on one button the data will be displayed like this in the listview: colA colB colC ----- ----- ------...
7
by: Progalex | last post by:
Hi everybody! I have a listview and a treeview in a form . With an OpenDialog I let the user select multiple files and then these files are added to the listview with the complete pathname,...
3
by: Julian Milano | last post by:
I'm using the following code to act on only the selected items in a listview. The items are selected via checkboxes: Dim indexes As ListView.SelectedIndexCollection = .SelectedIndices For Each i...
1
by: dvestal | last post by:
I have a ListView with checkboxes. I want to remove items when the checkboxes are unchecked, but to do so yields an ArgumentOutOfRangeException. Is there an easy way to get around this? A...
1
by: Garudzo | last post by:
Hi all I am developning a small application in MS Access 2003 on a windows XP platform. I am using windows treeview and Listview controls. I have discovered that I can do a multi select of...
1
by: =?Utf-8?B?TWFyayBDb2xsYXJk?= | last post by:
Hello I've added a listview to my WinForms C# 2.0 application. The listview is displayed in Details view and has the FullRowSelect property set to true. I'm using the listview control like a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.