CULng Function

CULng Function is used to convert a data type to ULong data type.


Syntax

CULng (expression)

Working with CULng function


Here we are going to create a project in which we are using a CULng function:


  • Create a new project in Visual Studio 2010 by selecting File ➪ New Project from the menu bar. In the New Project dialog, select Windows Forms Application from the right-hand pane, enter the project name as CULngFunction, and click OK as shown in figure:
  • culng-function

  • Now drag and drop a Button control from the toolbox to the form and change its text property to "ShowValueAfterConversion" as given below in the diagram:
  • culng-function

  • Double-click the button "ShowValueAfterConversion" to open the Button1.Click event handler. Add the following given code to it:
  • Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    Dim d As Double = 10.4356789012
    MessageBox.Show("Value After conversion from Double datatype to ULong datatype:" & CULng(d).ToString, _"CULngFunction")
    End Sub

  • Now execute the project by pressing F5 key it will open a form as follows:
  • culng-function

  • Now click on the button "ShowValueAfterConversion" present on the form this will show you a message box as follows:
  • culng-function