You can use the
ApplyChanges event to write the information
from the Property Page back to the actual property values of the selected controls.
ApplyChanges fires when the user Clicks the Apply
button or the OK button on your Property Page or switches to another Property Page of your
control.
As you can see in Listing 13.19, we use the SelectedControls
collection to determine the controls that the developer has selected for modification.
Notice that just as we did in the SelectionChanged event procedure, we
distinguish between properties that should be changed for just one control and properties
that can be changed for all controls.
LISTING 13.19
SAVING PROPERTY CHANGES BACK TO CONTROLS IN
THE APPLYCHANGES EVENT PROCEDURE
Private Sub ApplyChanges()
'This change only applies if
'just one control is selected
If SelectedControls.Count = 1 Then
SelectedControls(0).MyName = _
txtMyName.Text
End If
'This change only applies to
'the first control in the selection
SelectedControls(0).Climate = _
txtClimate.Text
'This change applies to all
'controls in the selection
Dim ctrl As Control
For Each ctrl In SelectedControls
ctrl.TempDate = txtTempDate.Text
Next ctrl
End Sub