Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

VB .NET - Learn Visual Basic .NET

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 13

Saving Property Changes with the ApplyChanges Event

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


  

<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved