Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Net
- Public Class Form1
- Public tecaj As Byte() 'vrijednost tečaja
- Public webKlijent As WebClient
- Public pomnozi As String
- Public spremi As New System.Text.ASCIIEncoding()
- Public uDecimal As Decimal
- Public provjera As Boolean
- Public uneseniBroj As Decimal
- Private Function dobivanjeValute(ByRef uDecimal) As Decimal
- Dim webKlijent As New WebClient()
- tecaj = webKlijent.DownloadData("http://www.hvka.org/valuta.php?q=1" + iz.Text + "=?" + u.Text)
- pomnozi = spremi.GetString(tecaj)
- uDecimal = Val(pomnozi)
- Return (uDecimal)
- End Function
- Private Sub unos_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles unos.TextChanged
- If (String.IsNullOrEmpty(unos.Text)) Then
- rezultat.Text = ""
- End If
- If (IsNumeric(unos.Text) = False) Then
- rezultat.Text = ""
- End If
- If (IsNumeric(unos.Text) = False) And Not (String.IsNullOrEmpty(unos.Text)) Then
- kriviUnos.Enabled = True
- Else
- If (unos.Text = "") Then
- kriviUnos.Enabled = False
- End If
- If Not (unos.Text = "") Then
- uneseniBroj = unos.Text
- End If
- End If
- End Sub
- Private Sub pretvori_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pretvori.Click
- If (unos.Text = "") Or Not (IsNumeric(unos.Text)) Then
- MsgBox("Molimo unesite valjanu vrijednost.", MsgBoxStyle.Information, "That's an error")
- End If
- If (iz.Text = u.Text) Or (String.IsNullOrEmpty(iz.SelectedItem)) Or (String.IsNullOrEmpty(u.SelectedItem)) Then
- MsgBox("Molimo odaberite odgovarajuće valute.", MsgBoxStyle.Information, "That's an error")
- Else
- dobivanjeValute(uDecimal)
- rezultat.Text = unos.Text * uDecimal
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement