|
ActiveSizer’s SubForm property loads designated forms into an ActiveSizer control. This allows your application to display forms inside of forms at run time. - Add ActiveSizer to a form and give it a unique name.
- Size ActiveSizer to the dimensions of the form or object that will display inside the control at run time. If ActiveSizer’s dimensions are less than those of the form or object that will display at run time, ActiveSizer will generate scrollbars.
- Set ActiveSizer’s properties to dictate how the control will behave at run time.
- Create and design a new form. This is the subform that will load inside the ActiveSizer control at run time.
- In the Form_Load event for the form on which ActiveSizer is placed, set the ActiveSizer’s SubForm property equal to a new instance of the SubForm object you have created, as shown in the example below.
Focus and Tabbing While subforms appear as part of the host form, they do not join the tabbing sequence of the parent. A workaround to this issue is implemented in the SubForms sample in your samples directory. You should use the GotFocus event of the ActiveSizer control that hosts the subform to activate the subform and shift tab control to it. You can add additional code in your subforms to shift the tab control back to the hosting form when the user tabs away from the last control on the subform. Private Sub ActiveSizer1_GotFocus() ' Verify that the SubForm property is valid and set If ActiveSizer1.SubForm Is Nothing Then Exit Sub End If
' Move the focus to the subform ActiveSizer1.SubForm.SetFocus End Sub Example
' The code below loads the subforms into ActiveSizer1 and ActiveSizer2, as shown in the sample figures.
Private Sub Form_Load() ActiveSizer1.SubForm = New SubForm1 ActiveSizer2.SubForm = New SubForm2 End Sub
|