Not getting result by this code in vb


#1

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim number, amt As String
number = T1.Text
Dim i = 0
Dim ary(8)
While (number >= 1)
i = i + 1
ary(i) = number Mod 10
number = number / 10
End While
amt = " mangal"
If (i = 6) Then
Call strt(ary(6))
amt += " Lakh"
End If
If (i = 5) Then
Call complex(ary(5), ary(4))
amt += " Thousand"
End If
If (i = 4) Then
Call strt(ary(4))
amt += " Thousand"
End If
If (i = 3) Then
Call strt(ary(5))
amt += " Hundred"
End If
If (i = 2) Then
Call complex(ary(2), ary(1))
End If
If (i = 1) Then
Call strt(ary(1))
End If
MsgBox(amt)
End Sub
Private Sub strt(ByVal ary As Object)
Select Case ary
Case 1
amt += " One"
Case 2
amt += " Two"
Case 3
amt += " Three"
Case 4
amt += " Four"
Case 5
amt += " Five"
Case 6
amt += " Six"
Case 7
amt += " Seven"
Case 8
amt += " Eight"
Case 9
amt += " Nine"
End Select
End Sub

Private Sub complex(ByVal ary As Object, ByVal scnd As Integer)
    Select Case ary
        Case 1
            Select Case scnd
                Case 1
                    amt += " Eleven"
                Case 2
                    amt += " Twelve"
                Case 3
                    amt += " Thirteen"
                Case 4
                    amt += " Fourteen"
                Case 5
                    amt += " Fifteen"
                Case 6
                    amt += " Sixteen"
                Case 7
                    amt += " Seventeen"
                Case 8
                    amt += " Eighteen"
                Case 9
                    amt += " Nineteen"
                Case 0
                    amt += " Ten"
            End Select
        Case 2
            amt += " Twenty"
        Case 3
            amt += " Thirty"
        Case 4
            amt += " Fourty"
        Case 5
            amt += " Fifty"
        Case 6
            amt += " Sixty"
        Case 7
            amt += " Seventy"
        Case 8
            amt += " Eighty"
        Case 9
            amt += " Ninty"
        Case 0
            amt += " "
    End Select
End Sub

End Class