Home Forums WinForms controls Xceed Grid for WinForms Suspend Eventhandler?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13721 |

    Hi all,

    my grid has an event handler on each cell:

    AddHandler cell.ValueChanged, AddressOf Me.cellEdit_ValueChanged

    Frequently I update cell-values automatically. The event is then called because the value changed. But I only want to call it if the user changes the values. Begininit and Endinit does not seem to work in this case. Any ideas?

    Imported from legacy forums. Posted by Kai (had 1903 views)

    User (Old forums)
    Member
    Post count: 23064

    What I do in cases like this: I have a boolean variable suspendEvents that I set to true before the update, and to false after the update. Inside the eventhandler I check if this variable is false. Like this:<code>bool suspendEvents;

    suspendEvents = true;
    // do the update
    suspendEvents = false;</code>
    Inside the eventhandler:<code>if (!suspendEvents) {
    // perform functionality
    }</code>

    Imported from legacy forums. Posted by Tommy (had 2882 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.