VB.Net program to demonstrate the Asc() function

Here, we are going to demonstrate the Asc() function in VB.Net.
Submitted by Nidhi, on December 04, 2020 [Last updated : March 05, 2023]

Asc() function in VB.Net

The Asc() function is used to get the ASCII value corresponding specified character.

Syntax

Asc(character)

Parameter(s)

  • character: It is a string that contains a single character.

Return Value

The Asc() function will return the ASCII value corresponding specified character.

VB.Net code to demonstrate the example of Asc() function

The source code to demonstrate the Asc() function is given below. The given program is compiled and executed successfully.

'VB.Net program to demonstrate the Asc() function.

Module Module1

    Sub Main()
        Dim num As Integer = 0

        num = Asc("c")

        Console.WriteLine("Ascii value: {0}", num)
    End Sub

End Module

Output:

Ascii value: 99
Press any key to continue . . .

Explanation:

In the above program, we created a module Module1 that contains a Main() method. In the Main() method, we created a variable num, which is initialized with 0.

num = Asc("c")

In the above code, we used the Asc() function that will return the ASCII value corresponding to the specified character. Then we printed the character on the console screen.

VB.Net Basic Programs »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.