ADVERTISEMENT
ADVERTISEMENT

VB.Net program to demonstrate the CULng() function

Here, we are going to demonstrate the CULng() function in VB.Net.
Submitted by Nidhi, on December 04, 2020

The CULng() function is used to convert different data types value into the unsigned long integer type.

Syntax:

CULng(val)

Parameters:

  • val: It may be a variable of different data types.

Return Value:

The CULng() function will return a converted unsigned long integer number.

Program/Source Code:

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

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

Module Module1

    Sub Main()
        Dim num As ULong = 0

        Dim n1 As Single = 10.25
        Dim n2 As Integer = 12
        Dim n3 As Double = 25.35
        Dim n4 As String = "122"

        num = CULng(n1)
        Console.WriteLine("Unsigned Long Integer Number: {0}", num)

        num = CULng(n2)
        Console.WriteLine("Unsigned Long Integer Number: {0}", num)

        num = CULng(n3)
        Console.WriteLine("Unsigned Long Integer Number: {0}", num)

        num = CULng(n4)
        Console.WriteLine("Unsigned Long Integer Number: {0}", num)
    End Sub
    
End Module

Output:

Unsigned Long Integer Number: 10
Unsigned Long Integer Number: 12
Unsigned Long Integer Number: 25
Unsigned Long Integer Number: 122
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 five variables num, n1, n2, n3, and n4 that are initialized with 0, 10.25, 12, 25.35, and "122".

num = CULng(n1)
Console.WriteLine("Unsigned Long Integer Number: {0}", num)

num = CULng(n2)
Console.WriteLine("Unsigned Long Integer Number: {0}", num)

num = CULng(n3)
Console.WriteLine("Unsigned Long Integer Number: {0}", num)

num = CULng(n4)
Console.WriteLine("Unsigned Long Integer Number: {0}", num)

In the above code, we converted the value of the specified variable into an unsigned long integer number and printed them on the console screen.

VB.Net Basic Programs »



ADVERTISEMENT




ADVERTISEMENT



Comments and Discussions!

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.