Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Listview control selecting all items on addition
 

Listview control selecting all items on addition

Hi

I have a listview control on my form when I add item in a listview using button and select the currently added item and give focus to listview it selects all item instead of selecting one (Which is currently added)

Here is my code

ListViewItem itemFiller = new ListViewItem(pClip.XName());
itemFiller.Selected = true;
lstPlaylist.Focus();

Regards,Adeel Arshad
khushi83  Wednesday, July 01, 2009 7:05 AM
Hi
please use the following code

ListViewItem itemFiller = new ListViewItem("Three");
lstPlaylist.Items.Add(itemFiller);
lstPlaylist.SelectedItems.Clear();
lstItem.Selected = true;
lstPlaylist.Focus();

-- Thanks Ajith R [Remember to Mark as Answer if it is Helpful.]
  • Marked As Answer bykhushi83 Wednesday, July 01, 2009 8:48 AM
  •  
Ajith R Nair  Wednesday, July 01, 2009 7:27 AM
Hi
please use the following code

ListViewItem itemFiller = new ListViewItem("Three");
lstPlaylist.Items.Add(itemFiller);
lstPlaylist.SelectedItems.Clear();
lstItem.Selected = true;
lstPlaylist.Focus();

-- Thanks Ajith R [Remember to Mark as Answer if it is Helpful.]
  • Marked As Answer bykhushi83 Wednesday, July 01, 2009 8:48 AM
  •  
Ajith R Nair  Wednesday, July 01, 2009 7:27 AM

You can use google to search for other answers

Custom Search

More Threads

• error HRESULT E_FAIL has been returned from a call to a COM componet.
• Combobox does not access key stroke
• OCX interop, is it possible????
• one cotrol, can it had TWO DesignerAttribute?
• How to create and Invisible Groupbox
• ShowGrid and UseSnapLines
• query regarding the Autos and Locals windows in .net 2003 environment
• Drawing images and manipulating with that
• Adding controls on the fly
• design time and compile time code