Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

ListView SelectedIndexChanged firing twice

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jared - 22 Feb 2006 22:28 GMT
Hi,

I have a Listview that is firing an event twice and both time the
selecteditems count is = 1

In the call stack there is form.show
Jared - 22 Feb 2006 22:34 GMT
It is actually firing three times, the selecteditems counts are 1,0,1

> Hi,
>
> I have a Listview that is firing an event twice and both time the
> selecteditems count is = 1
>
> In the call stack there is form.show
Claes Bergefall - 23 Feb 2006 14:28 GMT
You need to provide some more information
What exactly are you doing to see this behaviour?

   /claes

> It is actually firing three times, the selecteditems counts are 1,0,1
>
[quoted text clipped - 4 lines]
>>
>> In the call stack there is form.show
Jared - 28 Feb 2006 02:40 GMT
Only thing I can think of Is loading the Listview grid while form is not
visible.

I now have genric routine called from a Click event.  I successfully have
used SLI event on many other form with the normal double firing.
Norman Yuan - 23 Feb 2006 14:29 GMT
I think, this behavior is by design. That is, when you click an item in
listview, if thre is a previously selected one, that one gets deselected
first, then the clicked one gets selected. This behavior puzzled me when I
used listview first time in .NET. In old VB5/6, there is an event ItemClick,
which is not available in .NET listview anymore.

So, when I want to get a selected item in listview's SelectedIncdexChanged
event handler, I do this:

private void MyListView_SelectedIndexChanged(object sender.....)
{
   if (MyListView.SelectedItems.Count==0) return;

   //Then do whatever here.
}

> Hi,
>
> I have a Listview that is firing an event twice and both time the
> selecteditems count is = 1
>
> In the call stack there is form.show

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.