Hi all,
I want Vb.net code to insert commas between numbers in Indian format , i.e. 12345678 should be taken as 1,23,45,678. And this value will be taken for other textbox for further calculation. Like txtSTP.text=(1,23,45,678) * 0.12
Thanking you in advance
Veeraraghavan
Loading
veera raghavanPosted Jun 13, 2008, 5:28 AM
Jan MontanoPosted Jun 13, 2008, 3:45 AM
using System.Threading;
// insert two textboxes in your form: textBox1 & textBox2
private void Form1_Load(object sender, EventArgs e)
{
//Test1();
Thread.CurrentThread.CurrentCulture = new CultureInfo("hi-IN");
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
textBox2.Text = string.Format("{0:C}", Convert.ToDouble(textBox1.Text));
}
You'll notice that if you input numbers in textbox1, currency in indian format will be displayed on textbox2. To be able to display in the format you want. you must set or you must initialize a cultureinfo first.
*EDIT: oops this one is in c#. Please modify as you wish. The important thing here is the cultureinfo. goodluck.