AddChoice Method

Adds a new Choice object to the collection and sets common properties on the choice.

Syntax

AddChoice(ByVal Nothing as Category, ByVal Description as String, ByVal Type as String[, Text][, Interest][, Sequential][, Tag]) as Choice

Parameters

Nothing

The Category property of the new Choice object reserved for future use. Should be Nothing.

Description

The Description property of the new Choice object.

Type

The Type property of the new Choice object.

Text

The Text property of the new Choice object. If not specified, defaults to the same value as the Description parameter.

Interest

Interest property reserved for future use. Defaults to 100.

Sequential

The Sequential property of the new Choice object. Defaults to True.

Tag

If specified, adds a single unnamed tag to the Tags collection of the new Choice object.

Remarks

Other properties can be set on the returned object. This method fails for read-only Choices collections.

You can remove Choices added to the static Choices collection in a DesignTimeControlSite object by calling Revoke directly on the Choice object.

If you don't specify a Text parameter, the Text property of the created choice is a copy of the Description property but is not updated with when changes are made to the Description property.. However, subsequent changes to the Description property will not affect the Text property.

For example, the following code creates a Choice specifying the type and description but not the text. When the choice is added, its Text property becomes "SomeDescription."

Dim MyChoices as Choices
Dim MyChoice as Choice

Set MyChoice = MyChoices.AddChoice(Nothing, "SomeType", "SomeDescription")

You can explicitly set the Text property using either of the following statements.

Set MyChoice=MyChoices.AddChoice(Nothing, "SomeType", "SomeDescription", Text:="SomeText")

MyChoice.Text = "SomeText"

Applies to   Choices collection