How to: Respond to the Solver Data Binding Event
You can subscribe to the data binding event that is raised by a solver and respond to the event. The following procedure demonstrates how to add a data binding event and change the VariableUpperBound field in response to the event.
To respond to the solver data binding event
Add the following Imports or using statements to the top of the Program code file.
Declare a SolverContext object to create a model.
Add the following line of code to your model to subscribe to the solver data binding event.
Implement the context_DataBinding method. The following code changes the VariableUpperBound field. First, the code enumerates the indexes for every decision in the model by using the Indexes property, which is used as an array because decisions can have multiple indexes. The ComputeUpperBoundForIndex method is business logic that is user-defined.