HeaderPane
Main
Hide
Share Link
Print

Switching Event, SftTabs Class

Occurs before another tab is selected.

Class: SftTabs
Namespace: Softelvdm.SftTabsNET
Assembly: Softelvdm.SftTabsNET

Syntax

public event TabSwitchingEventHandler Switching;
Public Event Switching As TabSwitchingEventHandler

Comments

Occurs before another tab is selected.

The event can cancel the selection or redirect it to another tab. It also occurs when the SftTabs.SelectedIndex or SftTabs.SelectedTab property is set.

When the user switches tabs while a control on the current tab page has the input focus, that control is validated first. If validation fails, the tab is not switched and the Switching event does not occur.

Examples

C# View entire sample code

        private void buttonClear_Click(object sender, EventArgs e) {
            listView1.Items.Clear();
            strLastEvent = "";
            fLastEventDup = false;
        }

        private void sftTabs1_Switching(object sender, TabSwitchingEventArgs e) {
            DumpValues("Switching", e);

            // e.Cancel = true; would keep the current tab
        }

        private void sftTabs1_SwitchingDisabled(object sender, TabEventArgs e) {
            DumpValues("SwitchingDisabled", e);
        }

VB.NET View entire sample code

End Sub

Private Sub ButtonClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonClear.Click
    ListView1.Items.Clear()
    strLastEvent = ""
    fLastEventDup = False
End Sub

Private Sub SftTabs1_Switching(ByVal sender As System.Object, ByVal e As Softelvdm.SftTabsNET.TabSwitchingEventArgs) Handles SftTabs1.Switching
    DumpValues("Switching", e)

    ' e.Cancel = True would keep the current tab
End Sub

Private Sub SftTabs1_SwitchingDisabled(ByVal sender As System.Object, ByVal e As Softelvdm.SftTabsNET.TabEventArgs) Handles SftTabs1.SwitchingDisabled
    DumpValues("SwitchingDisabled", e)

See Also SftTabs Class | Classes | SftTabs/NET 3.0