Regarding selectedindexchange event in listview
-
hi all, I have customized listview to display images in thumbnail view as in windows explorer. I have set ownerdraw property as true and used the drawitem event of listview to redraw the listview. Now when i click any item in the listview, the selectedindexchange event is fired twice. Why is the event firing twice? What could be the problem? Any suggestions please.
Thanks in advance.:) Regards Anuradha
-
hi all, I have customized listview to display images in thumbnail view as in windows explorer. I have set ownerdraw property as true and used the drawitem event of listview to redraw the listview. Now when i click any item in the listview, the selectedindexchange event is fired twice. Why is the event firing twice? What could be the problem? Any suggestions please.
Thanks in advance.:) Regards Anuradha
Without any code it's really impossible to tell. But chances are it's not related to your custom draw code. I would guess that it's related to your code that hooks up the SelectedIndexChanged event. Unless you explicitly firing that event in your custom ListView control.
Take care, Tom ----------------------------------------------- Check out my blog at http://tjoe.wordpress.com
-
hi all, I have customized listview to display images in thumbnail view as in windows explorer. I have set ownerdraw property as true and used the drawitem event of listview to redraw the listview. Now when i click any item in the listview, the selectedindexchange event is fired twice. Why is the event firing twice? What could be the problem? Any suggestions please.
Thanks in advance.:) Regards Anuradha
Hi, some Controls with selection capabilities fire twice: once when they unselect the existing selection, and again when they apply the new selection. Check the EventArgs to get the details, and you will know whether it is this phenomenon, rather than the exactly same event firing twice. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
-
Hi, some Controls with selection capabilities fire twice: once when they unselect the existing selection, and again when they apply the new selection. Check the EventArgs to get the details, and you will know whether it is this phenomenon, rather than the exactly same event firing twice. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
hi, I have found one solution which seems to be working fine. but still i would like to have a better and liable solution. in the selectedindexchange event i wrote the following code. private void listView1_SelectedIndexChanged(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) MessageBox.Show("Clicked"); } is this solution right?
Thanks in advance.:) Regards Anuradha