Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple if statement that wont work

Status
Not open for further replies.

aspro

Programmer
Jan 22, 2003
69
AU
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
 
In CR, you could use:

ToWords(truncate({Table.Amount},0),0)+" dollars and "+ToWords(Val(Right(totext({Table.Amount}),2)),0)+" cents"

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top