Amount calculation
some error occured:reason..i dn't now to input get dropdown
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
PradeepRank #6,279 · 271 reputationPosted Mar 5, 2015, 7:35 PM EST
protected void Button1_Click(object sender, EventArgs e)
{
lblamtwrd.Text = "";
string[] Ones = new string[] { "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" };
string[] Twos = new string[] { "", "Eleven", "Twolve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Ninteen" };
string[] Tens = new string[] { "", "Ten", "Twenty", "Thirty", "Fourty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninty" };
int Crore = Convert.ToInt32(ddlCrore.SelectedValue);
txtamt.Text = Convert.ToString(Crore * 10000000);
int Onesdigit = 0;
int tensDigit = 0;
string StrCre = "";
string StrLcs = "";
string StrThsnd = "";
if (Crore > 19 || Crore == 10)
{
Onesdigit = Crore % 10;
tensDigit = Crore / 10;
StrCre = Tens[tensDigit] + " " + Ones[Onesdigit] + " Crore ";
}
else if (Crore > 10 && Crore < 20)
{
Onesdigit = Crore % 10;
StrCre = Twos[Onesdigit] + " Crore ";
}
else if (Crore < 10)
{
StrCre = Ones[Crore] + " Crore ";
}
int Lacs = Convert.ToInt32(ddlLacs.SelectedValue);
txtamt.Text = Convert.ToString(Convert.ToInt32(txtamt.Text) + (Lacs * 100000));
if (Lacs > 19 || Lacs==10 )
{
Onesdigit = Lacs % 10;
tensDigit = Lacs / 10;
StrLcs = Tens[tensDigit] + " " + Ones[Onesdigit] + " Lacs ";
}
else if (Lacs > 10 && Lacs < 20)
{
Onesdigit = Lacs % 10;
StrLcs = Twos[Onesdigit] + " Lacs ";
}
else
{
StrLcs = Ones[Lacs] + " Lacs ";
}
int Thsnds = Convert.ToInt32(ddlTsnd.SelectedValue);
txtamt.Text = Convert.ToString(Convert.ToInt32(txtamt.Text) + (Thsnds * 1000));
if (Thsnds > 19 || Thsnds == 10)
{
Onesdigit = Thsnds % 10;
tensDigit = Thsnds / 10;
StrThsnd = Tens[tensDigit] + " " + Ones[Onesdigit] + " Thousands ";
}
else if (Thsnds > 10 && Thsnds < 20)
{
Onesdigit = Thsnds % 10;
StrThsnd = Twos[Onesdigit] + " Thousands ";
}
else
{
StrThsnd = Ones[Thsnds] + " Thousands ";
}
lblamtwrd.Text = StrCre + " " + StrLcs + " " + StrThsnd;
}
Anil KumarRank #2,740 · 511 reputationPosted Mar 3, 2015, 12:36 AM EST
venky n115 reputationPosted Mar 3, 2015, 12:50 AM EST
protected void ddcroes_SelectedIndexChanged(object sender, EventArgs e)
VulpesRank #55 · 29.2K reputationPosted Mar 3, 2015, 1:08 AM EST
protected void ddcroes_SelectedIndexChanged(object sender, EventArgs e)
{
Total();
}
protected void ddlaks_SelectedIndexChanged(object sender, EventArgs e)
{
Total();
}
protected void ddths_SelectedIndexChanged(object sender, EventArgs e)
{
Total();
}
public static void Total()
{
int n, n1, n2;
int.TryParse(ddcroes.SelectedItem.Text, out n);
n *= 10000000;
int.TryParse(ddlaks.SelectedItem.Text, out n1);
n1 *= 100000;
int.TryParse(ddths.SelectedItem.Text, out n2);
n2 *= 1000;
int inputNumber = n + n1 + n2;
lblWords.Text = NumbersToWords(inputNumber);
}
venky n115 reputationPosted Mar 6, 2015, 9:05 PM EST