SlideShare a Scribd company logo
1 of 3
Download to read offline
G:My DocumentsMy WorksDMNumberToWordNumberToWordMainForm.cs   1
 1   using   System;
 2   using   System.Collections.Generic;
 3   using   System.ComponentModel;
 4   using   System.Data;
 5   using   System.Drawing;
 6   using   System.Text;
 7   using   System.Windows.Forms;
 8
 9   namespace NumberToWord
10   {
11       public partial class MainForm : Form
12       {
13           public MainForm()
14           {
15               InitializeComponent();
16           }
17
18             private void button1_Click(object sender, EventArgs e)
19             {
20                 ConvertToWord con = new ConvertToWord();
21                 //label1.Text = con.Convert(textBox1.Text);
22                 richTextBox1.Text = con.Convert(textBox1.Text);
23             }
24       }
25
26
27       public class ConvertToWord
28       {
29           string word = "";
30           int index, j;
31
32             public string Convert(string value)
33             {
34                 char[] number = value.ToCharArray();
35                 index = value.Length;
36                 j = 0;
37                 for (int i = index; i > 0; i--)
38                 {
39
40                     word += CharToWord(number[j], i, j);
41                     word += DigidToWord(number[j], i);
42
43
44                     j++;
45                 }
46
47
48
49                 return word;
50
51             }
52
53             string CharToWord(char value, int digit, int first)
54             {
55                 string wordChar = "";
56                 switch (value)
57                 {
58                     case '1':
59                         if ((digit % 6) == 1)
60                         {
61                              if (first == 0)
62                                   wordChar = " ";
63                              else
64                                   wordChar = " ";
65                         }
66                         else if ((digit % 6) == 2)
67                              wordChar = "";
68                         else
69                              wordChar = "   ";
70                         break;
71                     case '2':
72                         if ((digit % 6) == 2)
73                              wordChar = " ";
74                         else
G:My DocumentsMy WorksDMNumberToWordNumberToWordMainForm.cs   2
 75                           wordChar   = "    ";
 76                       break;
 77                   case '3':
 78                       wordChar = "     ";
 79                       break;
 80                   case '4':
 81                       wordChar = "   ";
 82                       break;
 83                   case '5':
 84                       wordChar = "    ";
 85                       break;
 86                   case '6':
 87                       wordChar = "   ก";
 88                       break;
 89                   case '7':
 90                       wordChar = "    ";
 91                       break;
 92                   case '8':
 93                       wordChar = "     ";
 94                       break;
 95                   case '9':
 96                       wordChar = "   ก ";
 97                       break;
 98
 99               }
100               return wordChar;
101           }
102
103           string DigidToWord(char value, int digit)
104           {
105               string wordDigit = "";
106               if (digit != 1)
107               {
108                   switch (digit % 6)
109                   {
110                       case 1:
111                           wordDigit = " ";
112                           break;
113                       case 2:
114                           if (value == '0')
115                                wordDigit = "";
116                           else
117                                wordDigit = " ";
118                           break;
119                       case 3:
120                           if (value == '0')
121                                wordDigit = "";
122                           else
123                                wordDigit = " ";
124                           break;
125                       case 4:
126                           if (value == '0')
127                                wordDigit = "";
128                           else
129                                wordDigit = " ";
130                           break;
131                       case 5:
132                           if (value == '0')
133                                wordDigit = "";
134                           else
135                                wordDigit = "   ";
136                           break;
137                       case 0:
138                           if (value == '0')
139                                wordDigit = "";
140                           else
141                                wordDigit = "   ";
142                           break;
143                   }
144               }
145
146
147               return wordDigit;
148           }
G:My DocumentsMy WorksDMNumberToWordNumberToWordMainForm.cs   3
149
150     }
151 }

More Related Content

Viewers also liked

Jisc RSC Eastern Technical Managers forum Feb 2013 'Janet (eduroam), Edward W...
Jisc RSC Eastern Technical Managers forum Feb 2013 'Janet (eduroam), Edward W...Jisc RSC Eastern Technical Managers forum Feb 2013 'Janet (eduroam), Edward W...
Jisc RSC Eastern Technical Managers forum Feb 2013 'Janet (eduroam), Edward W...JISC RSC Eastern
 
Lets SAASify that Desktop Application
Lets SAASify that Desktop ApplicationLets SAASify that Desktop Application
Lets SAASify that Desktop ApplicationIndicThreads
 
ePortfolio for Immigrants - International Medical Graduate version
ePortfolio for Immigrants - International Medical Graduate versionePortfolio for Immigrants - International Medical Graduate version
ePortfolio for Immigrants - International Medical Graduate versionDon Presant
 
Jisc RSC Eastern forum 14th March 2014 Destiny Wireless Presentation
Jisc RSC Eastern forum 14th March 2014 Destiny Wireless PresentationJisc RSC Eastern forum 14th March 2014 Destiny Wireless Presentation
Jisc RSC Eastern forum 14th March 2014 Destiny Wireless PresentationJISC RSC Eastern
 
Getting the most out of the marketing and fairs
Getting the most out of the marketing and fairsGetting the most out of the marketing and fairs
Getting the most out of the marketing and fairsLesley Ann Noel
 
VLE straight jacket or lego november 2010
VLE straight jacket or lego november 2010VLE straight jacket or lego november 2010
VLE straight jacket or lego november 2010JISC RSC Eastern
 
URISA Proposed the GIS Management Institute
URISA Proposed the GIS Management InstituteURISA Proposed the GIS Management Institute
URISA Proposed the GIS Management InstituteGreg Babinski
 
Dynamic Languages & Web Frameworks in GlassFish
Dynamic Languages & Web Frameworks in GlassFishDynamic Languages & Web Frameworks in GlassFish
Dynamic Languages & Web Frameworks in GlassFishIndicThreads
 
Phone for Me, Tablet for We: Building a multi screen app in One Hour
Phone for Me, Tablet for We: Building a multi screen app in One HourPhone for Me, Tablet for We: Building a multi screen app in One Hour
Phone for Me, Tablet for We: Building a multi screen app in One HourIndicThreads
 
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...IndicThreads
 
Van Gogh - Starry Night
Van Gogh - Starry NightVan Gogh - Starry Night
Van Gogh - Starry NightAnup Soans
 
Pick1 in Jack magazine - October 2011
Pick1 in Jack magazine - October 2011Pick1 in Jack magazine - October 2011
Pick1 in Jack magazine - October 2011Paolo Privitera
 
Pension Key Changes Jan 2011
Pension Key Changes Jan 2011Pension Key Changes Jan 2011
Pension Key Changes Jan 2011duncanorr
 
Jisc RSC Eastern Learning Resources Managers forum 14/03/14 - Mobile users an...
Jisc RSC Eastern Learning Resources Managers forum 14/03/14 - Mobile users an...Jisc RSC Eastern Learning Resources Managers forum 14/03/14 - Mobile users an...
Jisc RSC Eastern Learning Resources Managers forum 14/03/14 - Mobile users an...JISC RSC Eastern
 
Indic threads pune12-accelerating computation in html 5
Indic threads pune12-accelerating computation in html 5Indic threads pune12-accelerating computation in html 5
Indic threads pune12-accelerating computation in html 5IndicThreads
 
Mobile Web Applications using HTML5 [IndicThreads Mobile Application Develop...
Mobile Web Applications using HTML5  [IndicThreads Mobile Application Develop...Mobile Web Applications using HTML5  [IndicThreads Mobile Application Develop...
Mobile Web Applications using HTML5 [IndicThreads Mobile Application Develop...IndicThreads
 

Viewers also liked (19)

Jisc RSC Eastern Technical Managers forum Feb 2013 'Janet (eduroam), Edward W...
Jisc RSC Eastern Technical Managers forum Feb 2013 'Janet (eduroam), Edward W...Jisc RSC Eastern Technical Managers forum Feb 2013 'Janet (eduroam), Edward W...
Jisc RSC Eastern Technical Managers forum Feb 2013 'Janet (eduroam), Edward W...
 
Lets SAASify that Desktop Application
Lets SAASify that Desktop ApplicationLets SAASify that Desktop Application
Lets SAASify that Desktop Application
 
ePortfolio for Immigrants - International Medical Graduate version
ePortfolio for Immigrants - International Medical Graduate versionePortfolio for Immigrants - International Medical Graduate version
ePortfolio for Immigrants - International Medical Graduate version
 
Jisc RSC Eastern forum 14th March 2014 Destiny Wireless Presentation
Jisc RSC Eastern forum 14th March 2014 Destiny Wireless PresentationJisc RSC Eastern forum 14th March 2014 Destiny Wireless Presentation
Jisc RSC Eastern forum 14th March 2014 Destiny Wireless Presentation
 
Getting the most out of the marketing and fairs
Getting the most out of the marketing and fairsGetting the most out of the marketing and fairs
Getting the most out of the marketing and fairs
 
VLE straight jacket or lego november 2010
VLE straight jacket or lego november 2010VLE straight jacket or lego november 2010
VLE straight jacket or lego november 2010
 
Janet feb2014
Janet feb2014Janet feb2014
Janet feb2014
 
URISA Proposed the GIS Management Institute
URISA Proposed the GIS Management InstituteURISA Proposed the GIS Management Institute
URISA Proposed the GIS Management Institute
 
Dynamic Languages & Web Frameworks in GlassFish
Dynamic Languages & Web Frameworks in GlassFishDynamic Languages & Web Frameworks in GlassFish
Dynamic Languages & Web Frameworks in GlassFish
 
Phone for Me, Tablet for We: Building a multi screen app in One Hour
Phone for Me, Tablet for We: Building a multi screen app in One HourPhone for Me, Tablet for We: Building a multi screen app in One Hour
Phone for Me, Tablet for We: Building a multi screen app in One Hour
 
Pick1 teasing 01
Pick1 teasing 01Pick1 teasing 01
Pick1 teasing 01
 
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
 
Van Gogh - Starry Night
Van Gogh - Starry NightVan Gogh - Starry Night
Van Gogh - Starry Night
 
Pick1 in Jack magazine - October 2011
Pick1 in Jack magazine - October 2011Pick1 in Jack magazine - October 2011
Pick1 in Jack magazine - October 2011
 
Pension Key Changes Jan 2011
Pension Key Changes Jan 2011Pension Key Changes Jan 2011
Pension Key Changes Jan 2011
 
Jisc RSC Eastern Learning Resources Managers forum 14/03/14 - Mobile users an...
Jisc RSC Eastern Learning Resources Managers forum 14/03/14 - Mobile users an...Jisc RSC Eastern Learning Resources Managers forum 14/03/14 - Mobile users an...
Jisc RSC Eastern Learning Resources Managers forum 14/03/14 - Mobile users an...
 
Indic threads pune12-accelerating computation in html 5
Indic threads pune12-accelerating computation in html 5Indic threads pune12-accelerating computation in html 5
Indic threads pune12-accelerating computation in html 5
 
The move to m2 colchsfc
The move to m2 colchsfcThe move to m2 colchsfc
The move to m2 colchsfc
 
Mobile Web Applications using HTML5 [IndicThreads Mobile Application Develop...
Mobile Web Applications using HTML5  [IndicThreads Mobile Application Develop...Mobile Web Applications using HTML5  [IndicThreads Mobile Application Develop...
Mobile Web Applications using HTML5 [IndicThreads Mobile Application Develop...
 

Similar to Main Form Number To Word

ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชัน
ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชันตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชัน
ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชันWarawut
 
C++ program: All tasks .cpp
C++ program: All tasks .cppC++ program: All tasks .cpp
C++ program: All tasks .cppKhalid Waleed
 
C++ program: Numbers .cpp
C++ program: Numbers .cppC++ program: Numbers .cpp
C++ program: Numbers .cppKhalid Waleed
 
Program flowchart
Program flowchartProgram flowchart
Program flowchartSowri Rajan
 
javascript function & closure
javascript function & closurejavascript function & closure
javascript function & closureHika Maeng
 
c++ Lecture 4
c++ Lecture 4c++ Lecture 4
c++ Lecture 4sajidpk92
 
Ugly code
Ugly codeUgly code
Ugly codeOdd-e
 
Java Code for Sample Projects Loops
Java Code for Sample Projects LoopsJava Code for Sample Projects Loops
Java Code for Sample Projects Loopsjwjablonski
 
evil_server.cpp#include string #include cstdlib #include.pdf
evil_server.cpp#include string #include cstdlib #include.pdfevil_server.cpp#include string #include cstdlib #include.pdf
evil_server.cpp#include string #include cstdlib #include.pdffortmdu
 
lecture7.ppt
lecture7.pptlecture7.ppt
lecture7.pptEdFeranil
 

Similar to Main Form Number To Word (14)

ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชัน
ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชันตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชัน
ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชัน
 
C++ program: All tasks .cpp
C++ program: All tasks .cppC++ program: All tasks .cpp
C++ program: All tasks .cpp
 
C++ program: Numbers .cpp
C++ program: Numbers .cppC++ program: Numbers .cpp
C++ program: Numbers .cpp
 
Program flowchart
Program flowchartProgram flowchart
Program flowchart
 
Arduino Code
Arduino CodeArduino Code
Arduino Code
 
javascript function & closure
javascript function & closurejavascript function & closure
javascript function & closure
 
06 1 조건문
06 1 조건문06 1 조건문
06 1 조건문
 
c++ Lecture 4
c++ Lecture 4c++ Lecture 4
c++ Lecture 4
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
Ugly code
Ugly codeUgly code
Ugly code
 
Java Code for Sample Projects Loops
Java Code for Sample Projects LoopsJava Code for Sample Projects Loops
Java Code for Sample Projects Loops
 
evil_server.cpp#include string #include cstdlib #include.pdf
evil_server.cpp#include string #include cstdlib #include.pdfevil_server.cpp#include string #include cstdlib #include.pdf
evil_server.cpp#include string #include cstdlib #include.pdf
 
3. chapter ii
3. chapter ii3. chapter ii
3. chapter ii
 
lecture7.ppt
lecture7.pptlecture7.ppt
lecture7.ppt
 

Recently uploaded

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 

Recently uploaded (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

Main Form Number To Word

  • 1. G:My DocumentsMy WorksDMNumberToWordNumberToWordMainForm.cs 1 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Text; 7 using System.Windows.Forms; 8 9 namespace NumberToWord 10 { 11 public partial class MainForm : Form 12 { 13 public MainForm() 14 { 15 InitializeComponent(); 16 } 17 18 private void button1_Click(object sender, EventArgs e) 19 { 20 ConvertToWord con = new ConvertToWord(); 21 //label1.Text = con.Convert(textBox1.Text); 22 richTextBox1.Text = con.Convert(textBox1.Text); 23 } 24 } 25 26 27 public class ConvertToWord 28 { 29 string word = ""; 30 int index, j; 31 32 public string Convert(string value) 33 { 34 char[] number = value.ToCharArray(); 35 index = value.Length; 36 j = 0; 37 for (int i = index; i > 0; i--) 38 { 39 40 word += CharToWord(number[j], i, j); 41 word += DigidToWord(number[j], i); 42 43 44 j++; 45 } 46 47 48 49 return word; 50 51 } 52 53 string CharToWord(char value, int digit, int first) 54 { 55 string wordChar = ""; 56 switch (value) 57 { 58 case '1': 59 if ((digit % 6) == 1) 60 { 61 if (first == 0) 62 wordChar = " "; 63 else 64 wordChar = " "; 65 } 66 else if ((digit % 6) == 2) 67 wordChar = ""; 68 else 69 wordChar = " "; 70 break; 71 case '2': 72 if ((digit % 6) == 2) 73 wordChar = " "; 74 else
  • 2. G:My DocumentsMy WorksDMNumberToWordNumberToWordMainForm.cs 2 75 wordChar = " "; 76 break; 77 case '3': 78 wordChar = " "; 79 break; 80 case '4': 81 wordChar = " "; 82 break; 83 case '5': 84 wordChar = " "; 85 break; 86 case '6': 87 wordChar = " ก"; 88 break; 89 case '7': 90 wordChar = " "; 91 break; 92 case '8': 93 wordChar = " "; 94 break; 95 case '9': 96 wordChar = " ก "; 97 break; 98 99 } 100 return wordChar; 101 } 102 103 string DigidToWord(char value, int digit) 104 { 105 string wordDigit = ""; 106 if (digit != 1) 107 { 108 switch (digit % 6) 109 { 110 case 1: 111 wordDigit = " "; 112 break; 113 case 2: 114 if (value == '0') 115 wordDigit = ""; 116 else 117 wordDigit = " "; 118 break; 119 case 3: 120 if (value == '0') 121 wordDigit = ""; 122 else 123 wordDigit = " "; 124 break; 125 case 4: 126 if (value == '0') 127 wordDigit = ""; 128 else 129 wordDigit = " "; 130 break; 131 case 5: 132 if (value == '0') 133 wordDigit = ""; 134 else 135 wordDigit = " "; 136 break; 137 case 0: 138 if (value == '0') 139 wordDigit = ""; 140 else 141 wordDigit = " "; 142 break; 143 } 144 } 145 146 147 return wordDigit; 148 }