Name

Choose Function — Microsoft.VisualBasic.Interaction

Synopsis

Choose(index, item_1[,item_2, ...[, item_n]])
index required; Single

An expression that evaluates to the (1-based) index of the object to choose from the list

item_1-item_n required; any

A comma-delimited list of values from which to choose, or a ParamArray containing values from which to choose

Named Arguments

No

Return Value

The object chosen from the list

Description

Programmatically selects an object from a predefined list of objects (which are passed as parameters to the function) based on its ordinal position in the list. Using Choose is a simpler alternative to populating an array with fixed values.

Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.