AllExperts > C# 
Search      
C#
Volunteer
Answers to thousands of questions
 Home · More C# Questions · Answer Library  · Encyclopedia ·
More C# Answers
Question Library

Ask a question about C#
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Hosnieh [Sara]
Expertise
Questions which I can answers: 1- Programming (C#.net, Vb.net, javascript, HTML) more Web applications 2- CSS 3-Databases (Ms SQL server -all versions) 4-OS (workstation and servers (windows)) 5- MS office 6- General problems in computer software I cannot answer other kinds of questions which I did not mention here.

Experience
my CV: http://iran-americamarket.com/Contact.aspx I have more than 8 years Experience in IT field. my core skills are : • Asp.net Developer (Portal, Dynamic websites ,e-commercial websites) • Visual studio.net 2003,2005,2008 (VB.net , C#.net , AJAX.net) • O.O programming (n-tier Architecture) • Database (SQL server 2000-2005, Oracle9i, Ms Access) , TSQL, Stored procedures, Triggers • IIS 5-6 , SSL (Installation and configuration SSL) , Network(TCP/IP ,Active directory , DHCP, … ), Windows 2000-2003 Server Configuration and administration • UML (usecase diagram, class diagram) , Microsoft Project • Graphics Design( Photoshop , Flash ) • JavaScript , CSS, DHTML, XML • Hardware (physical installation, configuration , and driver installation) • Ms Office all versions (Ms word, Ms Access, Ms Excel, Ms Outlook , Ms FrontPage, and etc) • OS (Windows –Linux) and VMware • Network Monitoring (Solarwinds) • Computer Teacher, English Teacher • MATLAB (simulations and computation projects)

Organizations
-

Publications
Translation Experience English to Farsi • Use brain scan to predict when people will buy products . May 2008 (Published in AI Magazine) – Medicine , AI • Totally tubular motors _Tomorrow automation technology : March 2008 (Published in AI Magazine) – AI , Mechanic, Industry • Improving PLC compatibility and function flexibility: March 2008 (Published in AI Magazine) – AI , Robotics , Industry • Make packaging lines more flexible: January 2008 (Published in AI Magazine) – AI , Robotics , Industry • Personal CNC : December 2007 (Published in AI Magazine) – AI , Medical , Industry • Multipurpose optical tools Characterize as MEMS: December 2007 (Published in AI Magazine)- optical physics • Managing Innovation: November 2007 (Published in AI Magazine) – IT Management • Calculating the total value of ownership (TVO):October 2007 (Published in San-ate Hooshmand Magazine) -IT and Economics

Education/Credentials
I am currently student and doing my Master in Computer Network Engineering

Awards and Honors
- Poster about new methods of management in Organization( Entrepreneurship ) - 2007

Past/Present Clients
-

 
   

You are here:  Experts > Computing/Technology > Microsoft .NET > C# > c#

C# - c#


Expert: Hosnieh [Sara] - 10/23/2009

Question
QUESTION: hiiii i m atul arora
i wana to make a prog that read the int value if user enter 1 then show one if 123 show one two three. Plzzzzz help me

ANSWER: for instance you have a textbox on your form and a button
write this code in a click of your button
and a label

int i;
label1.Text="";
for(i=0;i<textbox1.Text.Length;i++)
{
switch(Convert.ToInt32(textBox1.Text[i].ToString())
{
case 0:
label1.Text +="zero ";
break;
case 1:
label1.Text +="one ";
break;
case 2:
label1.Text +="two ";
break;
case 3:
label1.Text +="three";
break;
case 4:
label1.Text +="four";
break;
case 5:
label1.Text +="five";
break;
case 6:
label1.Text +="six";
break;
case 7:
label1.Text +="seven";
break;
case 8:
label1.Text +="eight";
break;
case 9:
label1.Text +="nine";
break;
default:
label1.Text +="undefined";
break;
}
}


---------- FOLLOW-UP ----------

QUESTION: hiiiiiiii sara
i m completely satisfied
but i wana to add some thin lyk lack thousand hundred etc. in that lable
so plzzz tell me how it is posible ????????

ANSWER: Hello,
Thank you for your rating,
You mean when user entered "1000" it should write "one thousand" and so on?

---------- FOLLOW-UP ----------

QUESTION: yes u r right bt it shoud read the float value also. if 110.10 then show one hundred ten and ten paise only.

Answer
 private void button1_Click(object sender, EventArgs e)
       {

           int i,j,counter=0;
           label1.Text="";
           if (textBox1.Text.IndexOf('.') > -1) //if it has floating point
           {
               String[] str = textBox1.Text.Split('.');
               for (j = 0; j < 2; j++)
               {
                   if (j == 1)
                   {
                       label1.Text += " point ";
                       counter = 0;

                   }
                   for (i = 0; i < str[j].Length ; i++)
                   {
                       if (str[j].Length - counter != 2)
                           switch (Convert.ToInt32(str[j][i].ToString()))
                           {
                               case 1:
                                   label1.Text += "one ";
                                   break;
                               case 2:
                                   label1.Text += "two ";
                                   break;
                               case 3:
                                   label1.Text += "three ";
                                   break;
                               case 4:
                                   label1.Text += "four ";
                                   break;
                               case 5:
                                   label1.Text += "five ";
                                   break;
                               case 6:
                                   label1.Text += "six ";
                                   break;
                               case 7:
                                   label1.Text += "seven ";
                                   break;
                               case 8:
                                   label1.Text += "eight ";
                                   break;
                               case 9:
                                   label1.Text += "nine ";
                                   break;

                           }
                       else
                       {
                           switch (Convert.ToInt32(str[j][i].ToString()))
                           {
                               case 1:
                                   label1.Text += "ten ";
                                   break;
                               case 2:
                                   label1.Text += "twenty ";
                                   break;
                               case 3:
                                   label1.Text += "Thirty ";
                                   break;
                               case 4:
                                   label1.Text += "fourthy ";
                                   break;
                               case 5:
                                   label1.Text += "fifty ";
                                   break;
                               case 6:
                                   label1.Text += "sixty ";
                                   break;
                               case 7:
                                   label1.Text += "seventy ";
                                   break;
                               case 8:
                                   label1.Text += "eighty ";
                                   break;
                               case 9:
                                   label1.Text += "ninthy ";
                                   break;

                           }
                       }
                       switch (str[j].Length-counter)
                       {
                           case 3:
                               label1.Text += "hundred ";
                               break;
                           case 4:
                               label1.Text += "Thousand ";
                               break;
                           case 5:
                               label1.Text += "million ";
                               break;
                       }
                       counter++;
                   }

               }
           }
           else
           {
               counter = 0;
               for (i = 0; i < textBox1.Text.Length; i++)
               {
                   if (textBox1.Text.Length - counter != 2)
                       switch (Convert.ToInt32(textBox1.Text[i].ToString()))
                       {
                           case 1:
                               label1.Text += "one ";
                               break;
                           case 2:
                               label1.Text += "two ";
                               break;
                           case 3:
                               label1.Text += "three ";
                               break;
                           case 4:
                               label1.Text += "four ";
                               break;
                           case 5:
                               label1.Text += "five ";
                               break;
                           case 6:
                               label1.Text += "six ";
                               break;
                           case 7:
                               label1.Text += "seven ";
                               break;
                           case 8:
                               label1.Text += "eight ";
                               break;
                           case 9:
                               label1.Text += "nine ";
                               break;

                       }
                   else
                   {
                       switch (Convert.ToInt32(textBox1.Text[i].ToString()))
                       {
                           case 1:
                               label1.Text += "ten ";
                               break;
                           case 2:
                               label1.Text += "twenty ";
                               break;
                           case 3:
                               label1.Text += "Thirty ";
                               break;
                           case 4:
                               label1.Text += "fourthy ";
                               break;
                           case 5:
                               label1.Text += "fifty ";
                               break;
                           case 6:
                               label1.Text += "sixty ";
                               break;
                           case 7:
                               label1.Text += "seventy ";
                               break;
                           case 8:
                               label1.Text += "eighty ";
                               break;
                           case 9:
                               label1.Text += "ninthy ";
                               break;

                       }
                   }
                   switch (textBox1.Text.Length - counter)
                   {
                       case 3:
                           label1.Text += "hundred ";
                           break;
                       case 4:
                           label1.Text += "Thousand ";
                           break;
                       case 5:
                           label1.Text += "million ";
                           break;
                   }
                   counter++;
               }


           }



       }
just I did not expect any number between 11 to 19, for other numbers it works fine

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.