Click here to Skip to main content
15,886,783 members
Articles / Programming Languages / Java

Number To Word (Arabic Version)

Rate me:
Please Sign up or sign in to vote.
4.89/5 (44 votes)
21 Mar 2012CPOL4 min read 224.9K   10.7K   50  
An article that describes how to convert a number to written words in English and Arabic
Public Class Form1
    Dim currencies As New List(Of CurrencyInfo)()
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        currencies.Add(New CurrencyInfo(CurrencyInfo.Currencies.Syria))
        currencies.Add(New CurrencyInfo(CurrencyInfo.Currencies.UAE))
        currencies.Add(New CurrencyInfo(CurrencyInfo.Currencies.SaudiArabia))
        currencies.Add(New CurrencyInfo(CurrencyInfo.Currencies.Tunisia))
        currencies.Add(New CurrencyInfo(CurrencyInfo.Currencies.Gold))

        cboCurrency.DataSource = currencies

        cboCurrency_DropDownClosed(Nothing, Nothing)
    End Sub

    Private Sub cboCurrency_DropDownClosed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboCurrency.DropDownClosed
        txtNumber_TextChanged(Nothing, Nothing)

    End Sub

    Private Sub txtNumber_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtNumber.TextChanged
        Try
            Dim toWord As New ToWord(Convert.ToDecimal(txtNumber.Text), currencies(Convert.ToInt32(cboCurrency.SelectedValue)))
            txtEnglishWord.Text = toWord.ConvertToEnglish()
            txtArabicWord.Text = toWord.ConvertToArabic()
        Catch ex As Exception
            txtEnglishWord.Text = [String].Empty
            txtArabicWord.Text = [String].Empty
        End Try
    End Sub
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Software Developer (Senior) Taiba
Syrian Arab Republic Syrian Arab Republic
MCSE,MCSD,MCTS,MCITP
Working as I.T Manager for Taiba Gold & Jewels (http://khayata.org)

Comments and Discussions