Guest User

Untitled

a guest
Dec 28th, 2017
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. public partial class Form1 : Form
  2.     {
  3.         public Form1()
  4.         {
  5.             InitializeComponent();
  6.         }
  7.  
  8.         private void buttonDodaj_Click(object sender, EventArgs e)
  9.         {
  10.             List<ludzie> listaLudzi = new List<ludzie>();
  11.             listaLudzi.Add(new ludzie(textBoxImie.Text, textBoxNazwisko.Text, int.Parse(textBoxWiek.Text), textBoxPlec.Text));
  12.             foreach (ludzie item in listaLudzi)
  13.             {
  14.                 comboBox1.Items.Add(String.Format("{0} {1} {2} {3}", item.Imie, item.Nazwisko, item.Wiek, item.Plec));
  15.             }
  16.            
  17.         }
  18.     }
  19.     public class ludzie
  20.     {
  21.         public string Imie { get; set; }
  22.         public string Nazwisko { get; set; }
  23.         public int Wiek { get; set; }
  24.         public string Plec { get; set; }
  25.  
  26.         public ludzie(string imie, string nazwisko, int wiek, string plec)
  27.         {
  28.             imie = Imie;
  29.             nazwisko = Nazwisko;
  30.             wiek = Wiek;
  31.             plec = Plec;
  32.         }
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment