Advertisement
Guest User

Untitled

a guest
Mar 9th, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. Imports System.Net
  2.  
  3. Public Class Form1
  4.  
  5. Public tecaj As Byte() 'vrijednost tečaja
  6. Public webKlijent As WebClient
  7. Public pomnozi As String
  8. Public spremi As New System.Text.ASCIIEncoding()
  9. Public uDecimal As Decimal
  10. Public provjera As Boolean
  11. Public uneseniBroj As Decimal
  12.  
  13.  
  14.  
  15.  
  16. Private Function dobivanjeValute(ByRef uDecimal) As Decimal
  17.  
  18. Dim webKlijent As New WebClient()
  19. tecaj = webKlijent.DownloadData("http://www.hvka.org/valuta.php?q=1" + iz.Text + "=?" + u.Text)
  20. pomnozi = spremi.GetString(tecaj)
  21. uDecimal = Val(pomnozi)
  22.  
  23. Return (uDecimal)
  24. End Function
  25.  
  26. Private Sub unos_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles unos.TextChanged
  27.  
  28. If (String.IsNullOrEmpty(unos.Text)) Then
  29. rezultat.Text = ""
  30. End If
  31.  
  32. If (IsNumeric(unos.Text) = False) Then
  33. rezultat.Text = ""
  34. End If
  35.  
  36. If (IsNumeric(unos.Text) = False) And Not (String.IsNullOrEmpty(unos.Text)) Then
  37. kriviUnos.Enabled = True
  38. Else
  39. If (unos.Text = "") Then
  40. kriviUnos.Enabled = False
  41. End If
  42. If Not (unos.Text = "") Then
  43. uneseniBroj = unos.Text
  44. End If
  45. End If
  46.  
  47.  
  48. End Sub
  49.  
  50.  
  51.  
  52. Private Sub pretvori_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pretvori.Click
  53.  
  54.  
  55. If (unos.Text = "") Or Not (IsNumeric(unos.Text)) Then
  56. MsgBox("Molimo unesite valjanu vrijednost.", MsgBoxStyle.Information, "That's an error")
  57. End If
  58.  
  59. If (iz.Text = u.Text) Or (String.IsNullOrEmpty(iz.SelectedItem)) Or (String.IsNullOrEmpty(u.SelectedItem)) Then
  60. MsgBox("Molimo odaberite odgovarajuće valute.", MsgBoxStyle.Information, "That's an error")
  61.  
  62. Else
  63.  
  64. dobivanjeValute(uDecimal)
  65. rezultat.Text = unos.Text * uDecimal
  66.  
  67. End If
  68.  
  69.  
  70.  
  71.  
  72.  
  73. End Sub
  74.  
  75.  
  76. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement