none
How to disable contol's change events when binding source position changes? RRS feed

  • Question

  • Hallo,

    I have data table with many columns, it is  bound to my controls through binding source. I have many text boxes and combo boxes when something changes in the text box or combo box , i calculate something and store the result in result column. so every row in data table has many parameters and calculated result .

    My question is when the binding source position (or row in datagridview) changes i want to disable all those calculation events fired during text change or combo box selected index change events. I want those events to be fired only when value in the text field changes manually not during row change event. How do i do that? 

    Thanks

    Tuesday, August 20, 2019 7:01 PM

Answers

  • If there was no DataGridView you can remove then add events by overriding navigation buttons in a BindingNavigator or buttons for navigating. With a DataGridView you need to remove/add events in CellValidating or RowValidating or Row change events of a DataGridView. 

    When indicating remove/add events AddHandler and RemoveHandler.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by Shan1986 Sunday, September 8, 2019 7:52 AM
    Tuesday, August 20, 2019 8:10 PM
    Moderator

All replies

  • If there was no DataGridView you can remove then add events by overriding navigation buttons in a BindingNavigator or buttons for navigating. With a DataGridView you need to remove/add events in CellValidating or RowValidating or Row change events of a DataGridView. 

    When indicating remove/add events AddHandler and RemoveHandler.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by Shan1986 Sunday, September 8, 2019 7:52 AM
    Tuesday, August 20, 2019 8:10 PM
    Moderator
  • Hallo Karen,

    Thanks for the answer, is there an event in Listbox also? example i have data grid view and also a Listbox.

    Thanks 

    Thursday, August 22, 2019 12:46 PM
  • There are no events for this, all events that are close happen after the row selection has changed either via the ListBox or via a BindingSource.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Thursday, August 22, 2019 2:06 PM
    Moderator