Interaction

1.23 Interaction

AppActivate Procedure

Microsoft.VisualBasic.Interaction


[Interaction.]AppActivate(title)

 

title required; String or Integer

The name of the application as currently shown in the application window title bar. This can also be the task ID returned from the Shell function.

Description

Activates a window based on its caption.

Beep Procedure

Microsoft.VisualBasic.Interaction


Beep

 

Description

Sounds a tone through the computer's speaker.

Choose Function

Microsoft.VisualBasic.Interaction


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.

Command Function

Microsoft.VisualBasic.Interaction


Command(  )

 

Return Value

A String containing the command-line arguments

Description

Returns the command line arguments used when launching VB or an application created with VB.

Environ Function

Microsoft.VisualBasic.Interaction


Environ(expression)

 

expression required; String, or a numeric expression

If expression is a string, it must be the name of the required environment variable; if expression is numeric, it must be the 1-based ordinal number of the environment variable within the environment table.

Return Value

A String containing the text assigned to expression

Description

Returns the value assigned to an operating-system environment variable.

IIf Function

Microsoft.VisualBasic.Interaction


IIf(expression, truepart, falsepart)

 

expression required; Boolean

Expression to be evaluated

truepart required; any value or expression

Expression or value to return if expression is True

falsepart required; any value or expression

Expression or value to return if expression is False

Return Value

The value or result of the expression indicated by truepart or falsepart

Description

Returns one of two results, depending on whether expression evaluates to True or False. The function is typically avoided, particularly inside of a loop, because of its poor performance.

InputBox Function

Microsoft.VisualBasic.Interaction


InputBox(prompt[, title] [, defaultresponse] [, xpos] _
[, ypos])

 

prompt required; String

The message in the dialog box

title optional; String

The title bar of the dialog box

defaultresponse optional; String

String to be displayed in the text box on loading

xpos optional; Numeric

The distance in twips from the left-hand side of the screen to the left-hand side of the dialog box

ypos optional; Numeric

The distance in twips from the top of the screen to the top of the dialog box

Return Value

A String containing the contents of the text box from the InputBox dialog box

Description

Displays a dialog box containing a prompt for the user, a text box for entering data, and an OK, a Cancel, and (optionally) a Help button. When the user clicks OK, the function returns the contents of the text box.

MsgBox Function

Microsoft.VisualBasic.Interaction


MsgBox(prompt[, buttons][, title])

 

prompt required; String

The text of the message to display in the message box dialog box

buttons optional; MsgBoxStyle enumeration

The sum of the Button, Icon, DefaultButton, and Modality constant values

title optional; String

The title displayed in the title bar of the message box dialog box

Return Value

A MsgBoxResult enumeration constant indicating the button clicked by the user to close the message box

Description

Displays a dialog box containing a message, buttons, and optional icon to the user. The action taken by the user is returned by the function in the form of an enumerated constant.

Partition Function

Microsoft.VisualBasic.Interaction


Partition(number, start, stop, interval)

 

number required; Long

Number to evaluate against the intervals

start required; Long

Start of the range. Must be non-negative

stop required; Long

End of the range. Must be greater than start

interval required; Long

Size of each interval into which the range is partitioned

Return Value

A String containing the range within which number falls

Description

Returns a string that describes which interval contains the number.

Shell Function

Microsoft.VisualBasic.Interaction


Shell(pathname[,style][, Wait][, Timeout] )

 

pathname required; String

Name of the program to execute

style optional; AppWinStyle enumeration

The style of window and whether it receives the focus; its default value is AppWinStyle.MinimizedFocus.

Wait optional; Boolean

Boolean indicating whether to wait for the pathname application to finish execution before continuing execution of subsequent code; its default value is False.

Timeout optional; Integer

If Wait is True, number of milliseconds to wait for the pathname application to terminate before the Shell function times out. Its default value is -1 indicating that there is no timeout value.

Return Value

An Integer representing the Process ID, or 0

Description

Launches another application and, if successful, returns that application's task ID.

Switch Function

Microsoft.VisualBasic.Interaction


Switch(expr-1, value-1[, expr-2, value-2 ... [, _
  expr-n,value-n]])

 

expr required; Object

A number of expressions to be evaluated

value required; Object

An expression or value to return if the associated expression evaluates to True

Return Value

An Object value or expression

Description

Evaluates a list of expressions and, on finding the first expression to evaluate to True, returns an associated value or expression.

If none of the expressions is True, the Switch function returns Nothing.

If multiple expressions are True, Switch returns the value that corresponds to the first True expression.

 



VB. NET Language Pocket Reference
VB.NET Language Pocket Reference
ISBN: 0596004281
EAN: 2147483647
Year: 2002
Pages: 31

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net