|
|
Title | Create a new control using Load and put it in a Frame |
Description | This example shows how to create a new control and put it in a Frame in Visual Basic 6. The program uses Load to create the new control and then sets its Container property to the Frame control. |
Keywords | Controls.Add, new control, Frame |
Categories | Controls, Tips and Tricks |
|
|
Create the control using Load. Set its Container property to the Frame.
|
|
Private Sub Command1_Click(Index As Integer)
Dim new_index As Integer
Dim i As Integer
Dim max_top As Single
new_index = Option1.UBound + 1
Load Option1(new_index)
' Put the new button inside the right frame.
Set Option1(new_index).Container = Frame1(Index)
' Find the largest Top value in this frame.
For i = 0 To new_index - 1
If Option1(i).Container Is Frame1(Index) Then
If max_top < Option1(i).Top Then max_top = _
Option1(i).Top
End If
Next i
' Position the new control.
Option1(new_index).Top = max_top + _
Option1(new_index).Height
' Make the control visible.
Option1(new_index).Visible = True
End Sub
|
|
|
|
|
|