Advertisement
7_2009-2012 Custom Controls/ Forms/ Menus #217298

Getting a Reference to a VB 5.0 UserControl

Visual Basic 5.0 allows you to use UserControls to create ActiveX controls in your projects. The following code snippet does two things: It gets a reference to the form in which a UserControl is placed, and it gets a reference to that control on the form. by David Mendlen

AI

Ringkasan AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kode Sumber
original-source
Dim PControl As Object
Dim MyControl As Control
Dim AControl As Object
'Get my UserControl
For Each AControl In ParentControls
  If AControl.Name = Ambient.DisplayName Then
    Set MyControl = AControl
    Exit For
  End If
Next
'Get the Form UserControl is on
Set PControl = ParentControls.Item(1).Parent
While Not (TypeOf PControl Is Form)   Set PControl = PControl.Parent
Wend
Upload
Komentar Asli (3)
Dipulihkan dari Wayback Machine