private void button3_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(textBox1.Text) || String.IsNullOrEmpty(textBox2.Text) || String.IsNullOrEmpty(textBox3.Text)) { MessageBox.Show("Sva polja su obavezna!", "Greska"); } else { try { var pass = textBox3.Text; var md5 = new MD5CryptoServiceProvider(); var data = Encoding.ASCII.GetBytes(pass); var hash_pass = md5.ComputeHash(data); Korisnik korinsik = new Korisnik(); korinsik.lozinka = Convert.ToBase64String(hash_pass); korinsik.Ime = textBox1.Text; korinsik.korisnicko_ime = textBox2.Text; korinsik.Uloga = "Admin"; korinsik.dodaj_korisnika(); MessageBox.Show("Uspesno ste kreirali nalog!", "Uspeh"); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }