Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing control from a form
Message
De
24/03/2003 17:56:58
 
 
À
24/03/2003 17:04:37
Adrian Demaestri
Ministerio de Economia de La Prov. de Ba
La Plata, Argentine
Information générale
Forum:
Visual Basic
Catégorie:
Contrôles ActiveX
Divers
Thread ID:
00769479
Message ID:
00769516
Vues:
13
This message has been marked as the solution to the initial question of the thread.
This is because UserControl is a class and to call methods, defined in it, you must reference them with instance of the class (actual instance, not UserControl.Find).
I can suggest two options:
1. Define Find method (if you can) in code module (not in UserControl or class module). This method will become "shared" (in VB.NET terminology) or "static" (in C++/C# terminology). You will be able to call it only with its name ("Find"), but the method cannot reference UserControl and its members (this is by the same reason).
2. With some procedure call pass actual reference for the UserControl to the form. In form, declare argument as UserControl class name and on it use your method:
[In UserControl]
Load Form1
Set Form1.UserControlReference = Me
Form1.Show

[In Form1]
Private m_UCR As [UserControlClassName]

Private Property Get UserControlReference() As [UserControlClassName]

  Set UserControlReference = m_UCR
End Property

Friend Property Set UserControlReference(ByVal New_UCR As [UserControlClassName])

  Set m_UCR = New_UCR
End Property

Sub SomeMethod()

  UserControlReference.Find([arguments])
End Sub

Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000)

VB (.NET) - what other language do you need in the whole Universe?...

Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform