Siebel VB Language Reference > VB Language Reference >

Asc Function


This standard VB function returns an integer corresponding to the ANSI code of the first character in the specified string.

Syntax

Asc(string)

Argument
Description

string

A string expression of one or more characters

Returns

An integer corresponding to the ANSI code of the first character in the argument.

Usage

To change an ANSI code to string characters, use Chr.

Example

This example asks the user for a letter and returns its ANSI value.

Sub Button_Click
   Dim userchar As String
   Dim ascVal as Integer
   userchar = "Z"
   ascVal = Asc(userchar)
End Sub

See Also

Chr Function

Siebel VB Language Reference