Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void buttonDodaj_Click(object sender, EventArgs e)
- {
- List<ludzie> listaLudzi = new List<ludzie>();
- listaLudzi.Add(new ludzie(textBoxImie.Text, textBoxNazwisko.Text, int.Parse(textBoxWiek.Text), textBoxPlec.Text));
- foreach (ludzie item in listaLudzi)
- {
- comboBox1.Items.Add(String.Format("{0} {1} {2} {3}", item.Imie, item.Nazwisko, item.Wiek, item.Plec));
- }
- }
- }
- public class ludzie
- {
- public string Imie { get; set; }
- public string Nazwisko { get; set; }
- public int Wiek { get; set; }
- public string Plec { get; set; }
- public ludzie(string imie, string nazwisko, int wiek, string plec)
- {
- imie = Imie;
- nazwisko = Nazwisko;
- wiek = Wiek;
- plec = Plec;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment