OnBeforeViewChange Event

Microsoft FrontPage Visual Basic

Occurs before the view mode of the page window changes.

Private Sub expression_OnBeforeViewChange(ByVal TargetView As FpPageViewMode, Cancel As Boolean)

expression     A variable name which references an object of type PageWindowEx declared using the WithEvents keyword in a class module.

TargetView       An FpPageViewMode enumerated constant that represents the new view type.

Cancel       A Boolean that determines if the operation will be cancelled. If True, the view will not be changed.

ShowOnBeforeViewChange event as it applies to the WebWindowEx object.

Occurs before the view mode of the Web site window changes.

Private Sub expression_OnBeforeViewChange(ByVal TargetView As FpWebViewModeEx, Cancel As Boolean)

expression     A variable name which references an object of type WebWindowEx declared using the WithEvents keyword in a class module.

TargetView       An FpWebViewModeEx enumerated constant that represents the new view type.

Cancel       A Boolean that determines if the operation will be cancelled. If True, the view will not be changed.

Example

The following example prompts the user before changing the view of the page window. If the user clicks Yes, the view is changed.

Private Sub PageWindowEx_OnBeforeViewChange(ByVal TargetView As FpPageViewMode, _
                                                    Cancel As Boolean)
'Prompts user before changing views

    Dim blnAns As Boolean
    strAns = MsgBox("Are you sure you want to change the current view?", _
                    vbYesNo)
    If strAns = vbYes Then
        Cancel = False
    Else
        Cancel = True
    End If

End Sub