Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hello sir,

I want to split a decimal number

example 13.23

label1= 13
label2= 23


VB
Dim d As Double = 13.23
Dim s As String = Convert.ToString(d)
Dim strArray As String = s.Split("."C)
Dim beforeDecimalPoint As String = s(0)
Dim afterDecimalPoint As String = s(1)


Value of type '1-dimensional array of String' cannot be converted to 'String'.

can anyone tell me where is the problem in this code i am using vb2008
Posted
Comments
Sergey Alexandrovich Kryukov 5-Mar-13 13:28pm    
Why?!
—SA

1 solution

you complete code seems wrong. It should modify as follows.
C#
Dim d As Double = 13.23
Dim s As String = Convert.ToString(d)
Dim strArray() As String = s.Split("."C)
Dim beforeDecimalPoint As String = strArray(0)
Dim afterDecimalPoint As String = strArray(1)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900