Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. namespace WindowsFormsApp59
  2. {
  3. public partial class Form1 : Form
  4. {
  5. struct adat
  6. {
  7. public string nev;
  8. public bool vane;
  9. }
  10. adat x;
  11. List<adat> lista = new List<adat>();
  12. public Form1()
  13. {
  14. InitializeComponent();
  15.  
  16. }
  17.  
  18. private void button1_Click(object sender, EventArgs e)
  19. {
  20. x.nev = textBox1.Text;
  21. x.vane = checkBox1.Checked;
  22. lista.Add(x);
  23. }
  24.  
  25. private void button2_Click(object sender, EventArgs e)
  26. {
  27. int i = 0;
  28. while (i < lista.Count - 1 && lista[i].nev != textBox1.Text)
  29. i++;
  30. if (lista[i].nev != textBox1.Text) MessageBox.Show("ilyen fagyit nem forgalmazunk");
  31. else checkBox1.Checked = lista[i].vane;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement