次の方法で共有


Arabic Numeric Conversion Sample - From numbers to letter for Arabic

To get you started I wrote this simple sample that uses the Visual Studio International Pack 2.0 (VSIntlPack2), numeric conversion module to convert the numbers to Arabic words. This is an easy walk through to use the numeric conversion. First download the VS IntlPack2 from the link provided in my previous post:

1) I created a simple WinForm application.

2) Add Reference to “InternationNumericFormatter.dll” library.

3) In the WinForm designer:

a. Add a TextBox1: to accept the user numbers.

b. Add a Label1: to display the output of the numeric conversion module.

4) Add an event to handle the TextBox1.TextChanged.. and double click to go the code view

5) In the code:

a. First, add reference to the library and we’ll use the System.Globalization namespace so we can add it as well:

VB:

Imports Microsoft.International.Formatters

Imports System.Globalization

C# :

using Microsoft.International.Formatters;

using System.Globalization;

b. Add this code in the textbox1_TextChanged:

VB Code:

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

Dim Value As Double

Dim ArabicCulture As New CultureInfo("ar")

If Double.TryParse(TextBox1.Text, Value) Then

If Value <= 999999999999999999 Then

Label1.Text = InternationalNumericFormatter.FormatWithCulture("L", Value, ArabicCulture, ArabicCulture)

Else

Label1.Text = "The number is out of range"

End If

Else

Label1.Text = ""

End If

End Sub

C# Code:

private void textBox1_TextChanged(object sender, EventArgs e)

{

Double Value;

if (Double.TryParse(textBox1.Text, out Value))

{

if (Value <= 9999999999999999999)

label1.Text = InternationalNumericFormatter.FormatWithCulture("L", Value, null, new CultureInfo("ar"));

else

label1.Text = "The number is out of range";

}

else

label1.Text = "";

}

6) Build and run your app… and you can type the numbers in the textbox and see the words in the label.

I hope you enjoyed this walkthrough!

Comments

  • Anonymous
    November 10, 2009
    I have application developed in Visual Basic 6.0. How can use this dll InternationalNumericFormatter.resources.dll. Could you please provide the dll that suits to Visual Basic 6.0? Thanks in Advance

  • Anonymous
    November 11, 2009
    Thanks for your interest but We only support Visual Studio 2005 or higher. We don't support VB 6.

  • Anonymous
    February 05, 2012
    Where to find this InternationNumericFormatter.dll ???

  • Anonymous
    February 13, 2012
    It's part of the Visual Studio International Language pack, you can get it from : www.microsoft.com/.../details.aspx