Obviously I am missing something quite simple but I just cant see it. I want convert a number entered into a text box into words. eg. $12.10 to be twelve dollars and ten cents. Im putting the number into an array but for some reason when the loop gets to the decimal point it does not skip it.
Private num_array(8) As String
Private Sub display_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles display.Click
Dim length As Integer = number.TextLength()
Dim counter As Integer = 1
Dim i As Integer = 1
Dim j As Integer = 0
' MsgBox("length is " + length.ToString)
Do While i <= length
' MsgBox("char is " + number.Text.Chars(length - counter))
If number.Text.Chars(length - counter).Equals(".") Then
counter = counter + 1
i += 1
j += 1
Else
num_array(j) = number.Text.Chars(length - counter) 'put the char in the array
MsgBox(num_array(j))
counter = counter + 1
i += 1
j += 1
End If
Loop
end sub
just dont get it.
many thanks
aspro
Private num_array(8) As String
Private Sub display_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles display.Click
Dim length As Integer = number.TextLength()
Dim counter As Integer = 1
Dim i As Integer = 1
Dim j As Integer = 0
' MsgBox("length is " + length.ToString)
Do While i <= length
' MsgBox("char is " + number.Text.Chars(length - counter))
If number.Text.Chars(length - counter).Equals(".") Then
counter = counter + 1
i += 1
j += 1
Else
num_array(j) = number.Text.Chars(length - counter) 'put the char in the array
MsgBox(num_array(j))
counter = counter + 1
i += 1
j += 1
End If
Loop
end sub
just dont get it.
many thanks
aspro