Version

Form Property (RestoreTabEventArgs)

Returns or sets the Form associated with the tab.
Syntax
'Declaration
 
Public Property Form As Form
public Form Form {get; set;}
Remarks

During deserialization, the tab must be associated with a particular form. The PersistedInfo property of the MdiTab may be used to store information about the tab that can then be used in this event to recreate the Form. If the Form property is not set, the deserialized MdiTab will be discarded.

Example
The following example demonstrates how to use the RestoreTab event to handle initializing de-serialized MdiTab objects.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinTabs
Imports Infragistics.Win.UltraWinTabbedMdi

Private Sub ultraTabbedMdiManager1_RestoreTab(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTabbedMdi.RestoreTabEventArgs) Handles ultraTabbedMdiManager1.RestoreTab
    ' The 'RestoreTab' event is invoked during a call to 
    ' LoadFromBinary or LoadFromXml when deserializing the 
    ' serialized MdiTab objects. The event is invoked once 
    ' for each serialized tab so that it may be associated
    ' with an mdi child. If the Form is not initialized the 
    ' tab will be discarded.
    '

    ' The 'PersistedInfo' can be used to store any serializable 
    ' value. It is opaque to the tab and can be used to store 
    ' information to help recreate the form that the tab should
    ' be associated with.
    '
    Dim fileName As String = CType(e.Tab.PersistedInfo, String)

    ' By exiting without setting the 'Form' parameter,
    ' we're discarding the tab.
    If fileName = Nothing Or Not System.IO.File.Exists(fileName) Then
        Return
    End If

    ' Create the form that we will associate with the Tab. Normally 
    ' whenever an mdi child form is created, an MdiTab is automatically 
    ' created for the form but during the RestoreTab event, this will 
    ' not happen so that new forms may be created to associate with 
    ' a deserialized tab.
    '
    Dim edit As EditForm = New EditForm()
    edit.FileName = fileName

    ' set the MdiParent property of the new form so it
    ' will be an mdi child form. Since the event could 
    ' be caught somewhere other than the form class, we 
    ' can access the MdiParent via the associated 
    ' UltraTabbedMdiManager's MdiParent.
    edit.MdiParent = e.Tab.Manager.MdiParent

    ' The 'WasVisible' parameter indicates whether the tab
    ' was part of the HiddenTabs collection when the serialization
    ' took place. If the visible state is different, then the 
    ' tab will be moved to/from the HiddenTabs collection to/from
    ' a tab group as needed.
    '
    edit.Visible = e.WasVisible

    ' Set the 'Form' parameter so that the MdiTab will be 
    ' associated with the form.
    e.Form = edit
End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinTabs;
using Infragistics.Win.UltraWinTabbedMdi;

private void ultraTabbedMdiManager1_RestoreTab(object sender, Infragistics.Win.UltraWinTabbedMdi.RestoreTabEventArgs e)
{
	// The 'RestoreTab' event is invoked during a call to 
	// LoadFromBinary or LoadFromXml when deserializing the 
	// serialized MdiTab objects. The event is invoked once 
	// for each serialized tab so that it may be associated
	// with an mdi child. If the Form is not initialized the 
	// tab will be discarded.
	//

	// The 'PersistedInfo' can be used to store any serializable 
	// value. It is opaque to the tab and can be used to store 
	// information to help recreate the form that the tab should
	// be associated with.
	//
	string fileName = e.Tab.PersistedInfo as string;

	// By exiting without setting the 'Form' parameter,
	// we're discarding the tab.
	if (fileName == null || !System.IO.File.Exists(fileName))
		return;

	// Create the form that we will associate with the Tab. Normally 
	// whenever an mdi child form is created, an MdiTab is automatically 
	// created for the form but during the RestoreTab event, this will 
	// not happen so that new forms may be created to associate with 
	// a deserialized tab.
	//
	EditForm edit = new EditForm();
	edit.FileName = fileName;

	// set the MdiParent property of the new form so it
	// will be an mdi child form. Since the event could 
	// be caught somewhere other than the form class, we 
	// can access the MdiParent via the associated 
	// UltraTabbedMdiManager's MdiParent.
	edit.MdiParent = e.Tab.Manager.MdiParent;

	// The 'WasVisible' parameter indicates whether the tab
	// was part of the HiddenTabs collection when the serialization
	// took place. If the visible state is different, then the 
	// tab will be moved to/from the HiddenTabs collection to/from
	// a tab group as needed.
	//
	edit.Visible = e.WasVisible;

	// Set the 'Form' parameter so that the MdiTab will be 
	// associated with the form.
	e.Form = edit;
}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also