Gani tpt
asked on
Windows Forms ListView Controls Not working while cilck event
Hi,
I am using Windows Forms ListView Controls (ListView1 and ListView2).
pls. refer the screenshot for details.
When I click the button1, then the corresponding list1 selected item will transfer to Listview2.
for example, the first time I selected A, B, C and then click Button1. now the item will move to Listview2 control.
if I select the same item (A, B, C) again then click Button1, now and then the item should not come again in ListView2 controls.
the main concern is, to prevent the duplicate values in listview2.
Refer attached: Listview ScreenShot.jpg
my code
------------
PS: Pls. guide us how to prevent the duplicate values when I try to move the same values in listview2.
Listview-ScreenShot.png
I am using Windows Forms ListView Controls (ListView1 and ListView2).
pls. refer the screenshot for details.
When I click the button1, then the corresponding list1 selected item will transfer to Listview2.
for example, the first time I selected A, B, C and then click Button1. now the item will move to Listview2 control.
if I select the same item (A, B, C) again then click Button1, now and then the item should not come again in ListView2 controls.
the main concern is, to prevent the duplicate values in listview2.
Refer attached: Listview ScreenShot.jpg
my code
------------
private void Button1_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in Listview1.SelectedItems)
{
if (item.Text != null)
{
Listview2.Items.Add(item.Text);
}
}
}
PS: Pls. guide us how to prevent the duplicate values when I try to move the same values in listview2.
Listview-ScreenShot.png
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks..it's working...
That’s great Ganesh, glad to help. Please don’t forget to close the question by assigning points.
ASKER
Thanks it's working..
Open in new window