Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
microsoft.public.vb.general.discussion
Accessing properties of a UserControl object
Leo
9/22/2011 9:49:00 AM
How do I access the properties of a UserControl from classes or forms within
a UserControl project? I want to get access to the parent, but I might want
access to other properties or methods.
1 Answer
Dee Earley
9/22/2011 10:04:00 AM
0
On 22/09/2011 10:49, Leo wrote:
> How do I access the properties of a UserControl from classes or forms
> within a UserControl project? I want to get access to the parent, but I
> might want access to other properties or methods.
You pass a reference to the control to the form when you open it.
In the UC:
Sub ShowForm()
Set ThisForm = New Form1
ThisForm.Load Me
End Sub
In the Form:
Dim ParentUC As UserControlType
Public Sub Load(ByVal Parent As UserControlType)
Set ParentUC = Parent
End Sub
Be very careful if you also want to keep a reference to the form in the
user control as this can cause circular references which causes no end
of problems.
--
Dee Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...
iCode Systems
(Replies direct to my email address will be ignored.
Please reply to the group.)
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Accessing properties of a UserControl object
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password