Create a simple statement with named parameters

zhaozj2021-02-16  82

Create a simple statement with named parameters

For many internal functions, statements, and methods, Visual Basic provides naming parameter methods to quickly deliver the parameter values. For the named parameters, by assigning the named parameter, you can provide any multi-parameter in any order. To do this, type the named parameter, which will be colon, equal, and value (myargument: = "somevalue), can arrange these assignments in the order, and they are separated from comma. Note that the parameter order in the following example is opposite to the order of the desired parameters:

Function ListText (strName As String, Optional strAddress As String) List1.AddItem strName List2.AddItem strAddress End Sub Private Sub Command1_Click () ListText strAddress: = "12345", strName: = "Your Name" End Sub

If the process has some optional parameters to be specified, the above content is more useful.

转载请注明原文地址:https://www.9cbs.com/read-14623.html

New Post(0)