private void btnIzmeniKupca_Click(object sender, EventArgs e) { foreach (Control c in tabKupac.Controls) { if (c is TextBox && c.Text == "") { MessageBox.Show("Popunite sva polja!"); return; } } Regex regJmbg = new Regex("^[0-9]{13}$"); Regex regBroj = new Regex("^[0-9]{3}-[0-9]{3,4}-[0-9]{3}$"); if (!regJmbg.IsMatch(txtJMBG.Text) || !regBroj.IsMatch(txtTelefon.Text)) { MessageBox.Show("Neispravan jmbg ili telefon!"); return; } foreach (Control c in tabKupac.Controls) { if (c is TextBox && String.IsNullOrEmpty((c as TextBox).Text)) { MessageBox.Show("Popunite sva polja!"); return; } } int izmenjenId = int.Parse(txtIdKupca.Text); Kupac k = new Kupac(izmenjenId, txtIme.Text, txtPrezime.Text, txtJMBG.Text, txtTelefon.Text, dtDatumRod.Value, txtKorisnickoIme.Text, txtLozinka.Text); if (admin.IzmeniKupca(k) != null) { MessageBox.Show("Uspesno izmenjeno!"); lstKupci.Items.Clear(); foreach (Kupac kup in admin.ListaKupaca) { lstKupci.Items.Add(kup.ToString()); } dtDatumRod.Value = DateTime.Now; foreach (Control c in tabKupac.Controls) { if (c is TextBox) { c.Text = ""; } } } else { MessageBox.Show("Postoji korisnik sa datim korisnickim imenom!"); } //admin.ListaKupaca = admin.IzmeniKupca(k); }