-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform1cs.txt
44 lines (34 loc) · 1.03 KB
/
form1cs.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace WinFormsApp5
{
public partial class Form1 : Form
{
private List<Kisi> kisiler = new List<Kisi>();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void kaydet_Click(object sender, EventArgs e)
{
Kisi kisi = new Kisi();
kisi.Ad = adTextBox.Text;
kisi.Soyad = soyadTextBox.Text;
kisi.Adres = adresTextBox.Text;
kisiler.Add(kisi);
MessageBox.Show("Kişi başarıyla kaydedildi.");
}
private void ListeleButton_Click(object sender, EventArgs e)
{
listBox.Items.Clear();
var adlar = kisiler.Select(kisi => kisi.Ad).Distinct().ToList();
foreach (string ad in adlar)
{
listBox.Items.Add(ad);
}
}
}