ListViews SelectedIndexChanged Event Options

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ArunDhaJ

    #1

    ListViews SelectedIndexChanged Event Options

    Hi Friends,

    I'm using .Net1.1.
    The SelectedIndexCh anged event is generated twice when i change the
    selection. I think this is because the event is triggered when an
    item
    loses focus and the other item gains focus.
    I want this event to be triggered only once.


    Plz help me in solving this problem...


    Thanks in advance....


    Regards
    ArunDhaJ

  • Morten Wennevik [C# MVP]

    #2
    Re: ListViews SelectedIndexCh anged Event Options

    On Fri, 31 Aug 2007 14:56:06 +0200, ArunDhaJ <arundhaj@gmail .comwrote:
    Hi Friends,
    >
    I'm using .Net1.1.
    The SelectedIndexCh anged event is generated twice when i change the
    selection. I think this is because the event is triggered when an
    item
    loses focus and the other item gains focus.
    I want this event to be triggered only once.
    >
    >
    Plz help me in solving this problem...
    >
    >
    Thanks in advance....
    >
    >
    Regards
    ArunDhaJ
    >
    >
    A solution to secondary events is using a flag or similar that lets you detect if the event has been handled or not.

    --
    Happy coding!
    Morten Wennevik [C# MVP]

    Comment

    • Stanimir Stoyanov

      #3
      Re: ListViews SelectedIndexCh anged Event Options

      "ArunDhaJ" <arundhaj@gmail .comwrote in message
      news:1188564966 .426724.135730@ l22g2000prc.goo glegroups.com.. .
      The SelectedIndexCh anged event is generated twice when i change the
      selection. I think this is because the event is triggered when an
      item
      loses focus and the other item gains focus.
      I want this event to be triggered only once.
      By default the event is raised only once, when the new item gains focus, so
      this is unlikely to be the cause. You can check if you have manually
      attached a handler to the event. Removing it would be the best solution.

      EventHandlers are attached using the syntax: "listView.Selec tedIndexChanged
      += new EventHandler(.. .);".

      Best Regards,
      Stanimir Stoyanov
      www.stoyanoff.info | www.aeroxp.org

      Comment

      Working...