Dev Center > Windows Forms Forums > Windows Forms General > ListView Control generates beep on left-click/selection changed

Answered ListView Control generates beep on left-click/selection changed

  • Thursday, April 19, 2007 7:29 PM
     
     

    Hi there.  I have a ListView control (.NET FW 2.0) that is generating a beep whenever I do any interaction with it - select an item (arrow keys, mouse), click an item, double-click it, etc.  How do I get it to stop doing that?

     

    I created the control using Forms Designer, populate the control at runtime when the form is created, and I am only handling one event (OnItemActivate).  I have the following properties set in my control (only properties not set to defaults are listed):

     

    FullRowSelect = True

    View = Details

    AutoArrange = False

    Columns = (Collection)

    HeaderStyle = Nonclickable

    HideSelection = False

    LabelEdit = False

    LabelWrap = False

    MultiSelect = False

    ShowGroups = False

     

    Any ideas on what's going on here?

Answers

All Replies

  • Friday, April 20, 2007 9:05 AM
    Moderator
     
     
    Its not the properties.  The ItemActivate event would indeed run on that kind of input.  I'll have to assume it is your event handler code that causes the beep.  Post your code if you need help with it.
  • Monday, April 23, 2007 10:40 PM
     
     

    The control beeps whenever ANYTHING happens with it, though, and ItemActivate only runs if I double-click an item or press ENTER on it.  (I can prove that part works as expected, because I have a specific action that ALWAYS occurs when I activate an item.  That isn't the problem.)

  • Wednesday, May 09, 2007 1:38 AM
     
     

    Hello?  Bueller?  (Rather disappointed at the lack of response here.)

  • Wednesday, May 09, 2007 6:45 AM
    Moderator
     
     
    I asked you to post your code.  You didn't.  Please contact your colleague Raymond Chen for psychic power.

  • Wednesday, May 09, 2007 6:33 PM
     
     

    I'm not sure what code you need.  Do you want the auto-generated code that Form Designer created in order to initialize the control?  My implementation code for this listbox is quite large and spread-out.

     

    Also, as I mentioned before, the ONLY event I'm handling is ItemActivate, which doesn't fire unless I double-click (or press Enter) on an item in the Listbox.  The beep happens on a single-click, an arrow press, etc. - it's as though it's generating some sort of error condition, but it's not reporting it to my Debug window or in any other form than a beep I can't seem to shut off.

  • Wednesday, May 09, 2007 6:44 PM
     
     
    More specifically, it appears that the beep is generated by the SelectedIndexChanged or ItemSelectionChanged events, neither of which I'm handling in my code.  I shouldn't have to handle these events with no-op stubs just to prevent a beep. Stick out tongue
  • Wednesday, May 09, 2007 6:56 PM
     
     

    I'm beginning to think this is a bug with Windows Vista and .NET Framework.  When I attempt to catch messages being fired by this control, the beep no longer occurs.  The only data point I don't have is whether or not this beep occurs on a WinXP/Server machine.  (The app is written in .NET 2.0.)

     

    Also, handling the suspect events doesn't change the control's behavior at all.  I still get the beep, no matter what I do in the code.

  • Thursday, May 10, 2007 10:37 PM
     
     

    A little more info: I discovered that the beep occurs whenever I click on a SubItem in the ListView (any label within a column other than the first column).  It doesn't beep if I click on an item in the first column.

  • Friday, May 11, 2007 4:51 PM
     
     Answered

    Okay, I found a solution.  Apparently this IS a Vista-specific bug, and is not related to my code.  I found the answer on a Google Group: http://groups.google.com.au/group/microsoft.public.win32.programmer.gdi/browse_thread/thread/99a2b1f68b47c4d5/681bf4f839f72ee8

     

    The solution is to run regedit and browse to HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\CCSelect\.current\

    then double-click the (Default) value, clear out any data that's in that key, then click OK.  (Click OK even if it appears blank.)  Then the beep goes away on its own.