private void ButtonZapisz_Click(object sender, RoutedEventArgs e) { try { if (TextPesel.Text.Length == 11) { kln = new Pacjent(TextImie.Text, TextNazwisko.Text, TextUlica.Text, TextUlica.Text, TextKraj.Text, Convert.ToInt32(TextNr.Text), Convert.ToInt32(TextWiek.Text), Convert.ToInt64(TextPesel.Text), picture); MainWindow.klient[mainwindow.i] = (kln); this.Hide(); } else { MessageBox.Show("zla dlugosc pesela"); } } catch { MessageBox.Show("nr ulicy,wiek i pesel musi byc liczba"); } }