|
Cet article a fait l'objet d'une traduction automatique. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte. Informations supplémentaires.
|
Traduction
Source
|
Interaction.CallByName, méthode
Espace de noms : Microsoft.VisualBasic
Assembly : Microsoft.VisualBasic (dans Microsoft.VisualBasic.dll)
public static Object CallByName( Object ObjectRef, string ProcName, CallType UseCallType, params Object[] Args )
Paramètres
- ObjectRef
- Type : System.Object
Requis. Object . Pointeur qui désigne l'objet exposant la propriété ou la méthode.
- ProcName
- Type : System.String
Requis. String . Expression de type chaîne contenant le nom de la propriété ou de la méthode sur l'objet.
- UseCallType
- Type : Microsoft.VisualBasic.CallType
Requis. Membre de l'énumération de type CallType représentant le type de la procédure appelée. La valeur de CallType peut être Method, Get ou Set.
- Args
- Type : System.Object[]
Optionnel. ParamArray . Tableau de paramètres contenant les arguments à passer à la propriété ou la méthode appelée.
Valeur de retour
Type : System.Object| Exception | Condition |
|---|---|
| ArgumentException |
' Imports statements must be at the top of a module. Imports Microsoft.VisualBasic.CallType
Sub TestCallByName1() 'Set a property. CallByName(TextBox1, "Text", CallType.Set, "New Text") 'Retrieve the value of a property. MsgBox(CallByName(TextBox1, "Text", CallType.Get)) 'Call a method. CallByName(TextBox1, "Hide", CallType.Method) End Sub
Public Sub TestCallByName2() Dim col As New Collection() 'Store the string "Item One" in a collection by 'calling the Add method. CallByName(col, "Add", CallType.Method, "Item One") 'Retrieve the first entry from the collection using the 'Item property and display it using MsgBox(). MsgBox(CallByName(col, "Item", CallType.Get, 1)) End Sub
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (rôle principal du serveur non pris en charge), Windows Server 2008 R2 (rôle principal du serveur pris en charge avec SP1 ou version ultérieure ; Itanium non pris en charge)
Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.