Can anyone give a good and practical example where and how use the control called container?
Printable View
Can anyone give a good and practical example where and how use the control called container?
the control?
isn't it a parent object?
I don't think Container refers to a control by itself. I mean it's not something like a Textbox. For each control, the .Container object returns the reference of the control in which the said control is. For e.g. if you have a form and a textbox in that form, the form would be the container of the textbox. If you paste the following code in a form that has a textbox named Text1, you would see it right away:
VB Code:
Private Sub Form_Click() MsgBox Text1.Container.Name End Sub
Put a frame on the form named Frame1 and change the above code to :
VB Code:
Private Sub Form_Click() Set Text1.Container = Frame1 End Sub
Moreover the following is given in MSDN
.Quote:
Returns or sets the container of a control on a Form. Not available at design time.
Containers can be either forms, pictureboxes and frame controls.