This documentation is archived and is not being maintained.

Argument Data Type Declaration

Visual Studio .NET 2003

You declare a data type for an argument by using the As clause in its declaration. For example, the following function accepts a string and an integer:

Function Appointment(ByVal Day As String, ByVal Hour As Integer) As String
   ' Code to return any appointment for the given day and time.
End Function

If the type checking switch (Option Strict Statement) is off, the As clause is optional, except that if any one argument uses it, all arguments must use it. If type checking is on, the As clause is required for all procedure arguments.

If you intend to pass different data types to a particular argument, such as Byte to Integer or late bound classes to Object, you must have Option Strict Off.

See Also

Procedures | Procedure Arguments | Argument Passing ByVal and ByRef | Argument Passing by Position and by Name | Optional Arguments | Parameter Arrays | Type Checking | Function Statement | Data Types | Visual Basic Language and Run-Time Reference