VB.NET Currency Converter


SUBMITTED BY: Guest

DATE: Oct. 25, 2013, 2:24 p.m.

FORMAT: Text only

SIZE: 12.3 kB

HITS: 1139

  1. Hello everybody!
  2. Well, Currency converter is a simple tool that i've made with which you can convert easily and fastly any amount of money from one currency to another one. The "Convertions rates" are in real time, so you know that when you use the software, in that time, that amount of money worth.
  3. That program/source code use xe.com website.
  4. Picture: http://cur.lv/4ckov
  5. Let's start!
  6. A. Design
  7. 1. We use:
  8. [*] 4 Label
  9. [*] 2 Textbox
  10. [*] 2 Combobox
  11. [*] 1 ToolTip
  12. [*] 2 Name on Settings
  13. 2. Options
  14. [*] Form size: 255; 294
  15. [*] Label1 text(Amount) and location value(86; 19)
  16. [*] Label2 text(From:) and location value(91; 84)
  17. [*] Label3 text(To:) and location value(100; 138)
  18. [*] Label4 text(RESULT) and location value(90; 210)
  19. [*] Textbox1 location value(53; 39)
  20. [*] Textbox2 location value(8; 230)
  21. [*] Combobox1 location value(8; 104)
  22. [*] Combobox2 location value(8; 158)
  23. [*] Combobox1 Items:
  24. USD - US Dollar
  25. EUR - Euro
  26. GBP - British Pound
  27. INR - Indian Rupee
  28. AUD - Australian Dollar
  29. CAD - Canadian Dollar
  30. SGD - Singapore Dollar
  31. -------ALL CURRENCIES-------
  32. AED - Emirati Dirham
  33. AFN - Afghan Afghani
  34. ALL - Albanian Lek
  35. AMD - Armenian Dram
  36. ANG - Dutch Guilder
  37. AOA - Angolan Kwanza
  38. ARS - Argentine Peso
  39. AWG - Aruban or Dutch Guilder
  40. AZN - Azerbaijani New Manat
  41. BAM - Bosnian Convertible Marka
  42. BBD - Barbadian or Bajan Dollar
  43. BDT - Bangladeshi Taka
  44. BGN - Bulgarian Lev
  45. BHD - Bahraini Dinar
  46. BIF - Burundian Franc
  47. BMD - Bermudian Dollar
  48. BND - Bruneian Dollar
  49. BOB - Bolivian Boliviano
  50. BRL - Brazilian Real
  51. BSD - Bahamian Dollar
  52. BTN - Bhutanese Ngultrum
  53. BWP - Botswana Pula
  54. BYR - Belarusian Ruble
  55. BZD - Belizean Dollar
  56. CDF - Congolese Franc
  57. CHF - Swiss Franc
  58. CLP - Chilean Peso
  59. CNY - Chinese Yuan Renminbi
  60. COP - Colombian Peso
  61. CRC - Costa Rican Colon
  62. CUC - Cuban Convertible Peso
  63. CUP - Cuban Peso
  64. CVE - Cape Verdean Escudo
  65. CZK - Czech Koruna
  66. DJF - Djiboutian Franc
  67. DKK - Danish Krone
  68. DOP - Dominican Peso
  69. DZD - Algerian Dinar
  70. EGP - Egyptian Pound
  71. ERN - Eritrean Nakfa
  72. ETB - Ethiopian Birr
  73. FJD - Fijian Dollar
  74. FKP - Falkland Island Pound
  75. GBP - British Pound
  76. GEL - Georgian Lari
  77. GGP - Guernsey Pound
  78. GHS - Ghanaian Cedi
  79. GIP - Gibraltar Pound
  80. GMD - Gambian Dalasi
  81. GNF - Guinean Franc
  82. GTQ - Guatemalan Quetzal
  83. GYD - Guyanese Dollar
  84. HKD - Hong Kong Dollar
  85. HNL - Honduran Lempira
  86. HRK - Croatian Kuna
  87. HTG - Haitian Gourde
  88. HUF - Hungarian Forint
  89. IDR - Indonesian Rupiah
  90. ILS - Israeli Shekel
  91. IMP - Isle of Man Pound
  92. INR - Indian Rupee
  93. IQD - Iraqi Dinar
  94. IRR - Iranian Rial
  95. ISK - Icelandic Krona
  96. JEP - Jersey Pound
  97. JMD - Jamaican Dollar
  98. JOD - Jordanian Dinar
  99. JPY - Japanese Yen
  100. KES - Kenyan Shilling
  101. KGS - Kyrgyzstani Som
  102. KHR - Cambodian Riel
  103. KMF - Comoran Franc
  104. KPW - North Korean Won
  105. KRW - South Korean Won
  106. KWD - Kuwaiti Dinar
  107. KYD - Caymanian Dollar
  108. KZT - Kazakhstani Tenge
  109. LAK - Lao or Laotian Kip
  110. LBP - Lebanese Pound
  111. LKR - Sri Lankan Rupee
  112. LRD - Liberian Dollar
  113. LSL - Basotho Loti
  114. LTL - Lithuanian Litas
  115. LVL - Latvian Lat
  116. LYD - Libyan Dinar
  117. MAD - Moroccan Dirham
  118. MDL - Moldovan Leu
  119. MGA - Malagasy Ariary
  120. MKD - Macedonian Denar
  121. MMK - Burmese Kyat
  122. MNT - Mongolian Tughrik
  123. MOP - Macau Pataca
  124. MRO - Mauritanian Ouguiya
  125. MUR - Mauritian Rupee
  126. MVR - Maldivian Rufiyaa
  127. MWK - Malawian Kwacha
  128. MXN - Mexican Peso
  129. MYR - Malaysian Ringgit
  130. MZN - Mozambican Metical
  131. NAD - Namibian Dollar
  132. NGN - Nigerian Naira
  133. NIO - Nicaraguan Cordoba
  134. NOK - Norwegian Krone
  135. NPR - Nepalese Rupee
  136. NZD - New Zealand Dollar
  137. OMR - Omani Rial
  138. PAB - Panamanian Balboa
  139. PEN - Peruvian Nuevo Sol
  140. PGK - Papua New Guinean Kina
  141. PHP - Philippine Peso
  142. PKR - Pakistani Rupee
  143. PLN - Polish Zloty
  144. PYG - Paraguayan Guarani
  145. QAR - Qatari Riyal
  146. RON - Romanian New Leu
  147. RSD - Serbian Dinar
  148. RUB - Russian Ruble
  149. RWF - Rwandan Franc
  150. SAR - Saudi or Saudi Arabian Riyal
  151. SBD - Solomon Islander Dollar
  152. SCR - Seychellois Rupee
  153. SDG - Sudanese Pound
  154. SEK - Swedish Krona
  155. SHP - Saint Helenian Pound
  156. SLL - Sierra Leonean Leone
  157. SOS - Somali Shilling
  158. SPL - Seborgan Luigino
  159. SRD - Surinamese Dollar
  160. STD - Sao Tomean Dobra
  161. SVC - Salvadoran Colon
  162. SYP - Syrian Pound
  163. SZL - Swazi Lilangeni
  164. THB - Thai Baht
  165. TJS - Tajikistani Somoni
  166. TMT - Turkmenistani Manat
  167. TND - Tunisian Dinar
  168. TOP - Tongan Pa'anga
  169. TRY - Turkish Lira
  170. TTD - Trinidadian Dollar
  171. TVD - Tuvaluan Dollar
  172. TWD - Taiwan New Dollar
  173. TZS - Tanzanian Shilling
  174. UAH - Ukrainian Hryvna
  175. UGX - Ugandan Shilling
  176. USD - US Dollar
  177. UYU - Uruguayan Peso
  178. UZS - Uzbekistani Som
  179. VEF - Venezuelan Bolivar Fuerte
  180. VND - Vietnamese Dong
  181. VUV - Ni-Vanuatu Vatu
  182. WST - Samoan Tala
  183. XAF - Central African CFA Franc BEAC
  184. XAG - Silver Ounce
  185. XAU - Gold Ounce
  186. XCD - East Caribbean Dollar
  187. XDR - IMF Special Drawing Rights
  188. XOF - CFA Franc
  189. XPD - Palladium Ounce
  190. XPF - CFP Franc
  191. XPT - Platinum Ounce
  192. YER - Yemeni Rial
  193. ZAR - South African Rand
  194. ZMK - Zambian Kwacha
  195. ZWD - Zimbabwean Dollar
  196. [*] Combobox2 Items:
  197. USD - US Dollar
  198. EUR - Euro
  199. GBP - British Pound
  200. INR - Indian Rupee
  201. AUD - Australian Dollar
  202. CAD - Canadian Dollar
  203. SGD - Singapore Dollar
  204. -------ALL CURRENCIES-------
  205. AED - Emirati Dirham
  206. AFN - Afghan Afghani
  207. ALL - Albanian Lek
  208. AMD - Armenian Dram
  209. ANG - Dutch Guilder
  210. AOA - Angolan Kwanza
  211. ARS - Argentine Peso
  212. AWG - Aruban or Dutch Guilder
  213. AZN - Azerbaijani New Manat
  214. BAM - Bosnian Convertible Marka
  215. BBD - Barbadian or Bajan Dollar
  216. BDT - Bangladeshi Taka
  217. BGN - Bulgarian Lev
  218. BHD - Bahraini Dinar
  219. BIF - Burundian Franc
  220. BMD - Bermudian Dollar
  221. BND - Bruneian Dollar
  222. BOB - Bolivian Boliviano
  223. BRL - Brazilian Real
  224. BSD - Bahamian Dollar
  225. BTN - Bhutanese Ngultrum
  226. BWP - Botswana Pula
  227. BYR - Belarusian Ruble
  228. BZD - Belizean Dollar
  229. CDF - Congolese Franc
  230. CHF - Swiss Franc
  231. CLP - Chilean Peso
  232. CNY - Chinese Yuan Renminbi
  233. COP - Colombian Peso
  234. CRC - Costa Rican Colon
  235. CUC - Cuban Convertible Peso
  236. CUP - Cuban Peso
  237. CVE - Cape Verdean Escudo
  238. CZK - Czech Koruna
  239. DJF - Djiboutian Franc
  240. DKK - Danish Krone
  241. DOP - Dominican Peso
  242. DZD - Algerian Dinar
  243. EGP - Egyptian Pound
  244. ERN - Eritrean Nakfa
  245. ETB - Ethiopian Birr
  246. FJD - Fijian Dollar
  247. FKP - Falkland Island Pound
  248. GBP - British Pound
  249. GEL - Georgian Lari
  250. GGP - Guernsey Pound
  251. GHS - Ghanaian Cedi
  252. GIP - Gibraltar Pound
  253. GMD - Gambian Dalasi
  254. GNF - Guinean Franc
  255. GTQ - Guatemalan Quetzal
  256. GYD - Guyanese Dollar
  257. HKD - Hong Kong Dollar
  258. HNL - Honduran Lempira
  259. HRK - Croatian Kuna
  260. HTG - Haitian Gourde
  261. HUF - Hungarian Forint
  262. IDR - Indonesian Rupiah
  263. ILS - Israeli Shekel
  264. IMP - Isle of Man Pound
  265. INR - Indian Rupee
  266. IQD - Iraqi Dinar
  267. IRR - Iranian Rial
  268. ISK - Icelandic Krona
  269. JEP - Jersey Pound
  270. JMD - Jamaican Dollar
  271. JOD - Jordanian Dinar
  272. JPY - Japanese Yen
  273. KES - Kenyan Shilling
  274. KGS - Kyrgyzstani Som
  275. KHR - Cambodian Riel
  276. KMF - Comoran Franc
  277. KPW - North Korean Won
  278. KRW - South Korean Won
  279. KWD - Kuwaiti Dinar
  280. KYD - Caymanian Dollar
  281. KZT - Kazakhstani Tenge
  282. LAK - Lao or Laotian Kip
  283. LBP - Lebanese Pound
  284. LKR - Sri Lankan Rupee
  285. LRD - Liberian Dollar
  286. LSL - Basotho Loti
  287. LTL - Lithuanian Litas
  288. LVL - Latvian Lat
  289. LYD - Libyan Dinar
  290. MAD - Moroccan Dirham
  291. MDL - Moldovan Leu
  292. MGA - Malagasy Ariary
  293. MKD - Macedonian Denar
  294. MMK - Burmese Kyat
  295. MNT - Mongolian Tughrik
  296. MOP - Macau Pataca
  297. MRO - Mauritanian Ouguiya
  298. MUR - Mauritian Rupee
  299. MVR - Maldivian Rufiyaa
  300. MWK - Malawian Kwacha
  301. MXN - Mexican Peso
  302. MYR - Malaysian Ringgit
  303. MZN - Mozambican Metical
  304. NAD - Namibian Dollar
  305. NGN - Nigerian Naira
  306. NIO - Nicaraguan Cordoba
  307. NOK - Norwegian Krone
  308. NPR - Nepalese Rupee
  309. NZD - New Zealand Dollar
  310. OMR - Omani Rial
  311. PAB - Panamanian Balboa
  312. PEN - Peruvian Nuevo Sol
  313. PGK - Papua New Guinean Kina
  314. PHP - Philippine Peso
  315. PKR - Pakistani Rupee
  316. PLN - Polish Zloty
  317. PYG - Paraguayan Guarani
  318. QAR - Qatari Riyal
  319. RON - Romanian New Leu
  320. RSD - Serbian Dinar
  321. RUB - Russian Ruble
  322. RWF - Rwandan Franc
  323. SAR - Saudi or Saudi Arabian Riyal
  324. SBD - Solomon Islander Dollar
  325. SCR - Seychellois Rupee
  326. SDG - Sudanese Pound
  327. SEK - Swedish Krona
  328. SHP - Saint Helenian Pound
  329. SLL - Sierra Leonean Leone
  330. SOS - Somali Shilling
  331. SPL - Seborgan Luigino
  332. SRD - Surinamese Dollar
  333. STD - Sao Tomean Dobra
  334. SVC - Salvadoran Colon
  335. SYP - Syrian Pound
  336. SZL - Swazi Lilangeni
  337. THB - Thai Baht
  338. TJS - Tajikistani Somoni
  339. TMT - Turkmenistani Manat
  340. TND - Tunisian Dinar
  341. TOP - Tongan Pa'anga
  342. TRY - Turkish Lira
  343. TTD - Trinidadian Dollar
  344. TVD - Tuvaluan Dollar
  345. TWD - Taiwan New Dollar
  346. TZS - Tanzanian Shilling
  347. UAH - Ukrainian Hryvna
  348. UGX - Ugandan Shilling
  349. USD - US Dollar
  350. UYU - Uruguayan Peso
  351. UZS - Uzbekistani Som
  352. VEF - Venezuelan Bolivar Fuerte
  353. VND - Vietnamese Dong
  354. VUV - Ni-Vanuatu Vatu
  355. WST - Samoan Tala
  356. XAF - Central African CFA Franc BEAC
  357. XAG - Silver Ounce
  358. XAU - Gold Ounce
  359. XCD - East Caribbean Dollar
  360. XDR - IMF Special Drawing Rights
  361. XOF - CFA Franc
  362. XPD - Palladium Ounce
  363. XPF - CFP Franc
  364. XPT - Platinum Ounce
  365. YER - Yemeni Rial
  366. ZAR - South African Rand
  367. ZMK - Zambian Kwacha
  368. ZWD - Zimbabwean Dollar
  369. [*] My project->Settings->Da and a requirement value and type are string
  370. B. Codes
  371. 1. Imports:
  372. Imports System.Text.RegularExpressions
  373. 2. Privat Functions and custom Subs :
  374. Private Function GetBetween(ByVal input As String, ByVal str1 As String, ByVal str2 As String, ByVal index As Integer) As String
  375. Try
  376. Dim temp As String = Regex.Split(input, str1)(index + 1)
  377. Return Regex.Split(temp, str2)(0)
  378. Catch
  379. MsgBox("Fatal Error, please, contact Gr0wlit for more informations")
  380. End Try
  381. End Function
  382. Sub Grab()
  383. CheckForIllegalCrossThreadCalls = False
  384. Dim wc As New System.Net.WebClient
  385. Dim source As String = wc.DownloadString("http://www.xe.com/ucc/convert/?Amount=" & TextBox1.Text & "&From=" & From & "&To=" & T)
  386. Dim Result As String = GetBetween(source, "<td width=""47%"" align=""left"">", "<span class=""uccResCde"">", 0).Split("&")(0)
  387. TextBox2.Text = Result
  388. End Sub
  389. 3. Double click on Combobox1 and copy-paste code:
  390. From = ComboBox1.SelectedIndex.ToString
  391. From = ComboBox1.Items(From).ToString.Substring(0, 3)
  392. If Not ComboBox2.Text = "" Then
  393. If IsNumeric(TextBox1.Text) Then
  394. Label5.Text = ""
  395. thread1 = New System.Threading.Thread(AddressOf Grab)
  396. thread1.Start()
  397. End If
  398. End If
  399. 4. Double click on Combobox2 and copy-paste code:
  400. T = ComboBox2.SelectedIndex.ToString
  401. T = ComboBox2.Items(T).ToString.Substring(0, 3)
  402. If Not ComboBox1.Text = "" Then
  403. If IsNumeric(TextBox1.Text) Then
  404. Label5.Text = ""
  405. thread1 = New System.Threading.Thread(AddressOf Grab)
  406. thread1.Start()
  407. End If
  408. End If
  409. 5. Double click on Textbox1 and copy-paste code:
  410. If Not ComboBox2.Text = "" And Not ComboBox1.Text = "" Then
  411. If IsNumeric(TextBox1.Text) Then
  412. Label5.Text = ""
  413. thread1 = New System.Threading.Thread(AddressOf Grab)
  414. thread1.Start()
  415. End If
  416. End If
  417. 6. Double click on Textbox2 and copy-paste code:
  418. Try
  419. Clipboard.SetText(TextBox2.Text)
  420. Label5.Text = "Text copied!"
  421. Catch ex As Exception
  422. MsgBox("No currency selected!", MsgBoxStyle.Exclamation)
  423. End Try
  424. 6. Double click on Form1 and select FormClosing and copy-paste code:
  425. My.Settings.Da = ComboBox1.SelectedIndex
  426. My.Settings.a = ComboBox2.SelectedIndex
  427. 7. Double click on Form1 and copy-paste code:
  428. Try
  429. ComboBox1.SelectedIndex = My.Settings.Da
  430. ComboBox2.SelectedIndex = My.Settings.a
  431. Catch ex As Exception
  432. End Try
  433. Good luck. :D

comments powered by Disqus