Using CDbl Function in VB
CDbl function is used to convert a data into Double data type. See the simple example illustrated below for a better understanding of this CDbl function. The example below converts a data stored in a textbox and convert it into Double data type.
Dim Output As Double '---- Declaring Variable
TextBox1.Text = "234.456784" '--- Initialize the figure as a string stored in a textbox
Output = CDbl(Val(TextBox1.Text) * 3.142 * 10/100) '- Run the formula of multiplying the figure with pi, and then multiply it again by 10%.
MsgBox(Output) '-- The output retrieved will be 73.6663215328
Hope you could now be able to know how you can use this CDbl function and apply in your VB codes.
See Also CType Functions
Subscribe to:
Post Comments (Atom)

0 comments
Post a Comment