Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. using System.Windows.Forms;
  2.  
  3. namespace WindowsFormsApplication1
  4. {
  5.  
  6. public partial class Form1 : Form
  7. {
  8.  
  9. string Password = "Pass123";
  10. int k = 0;
  11. int m=0;
  12. Man[] groupSize = new Man[]
  13. {
  14. new Man()
  15. };
  16. public Form1()
  17. {
  18.  
  19. InitializeComponent();
  20. //label1.Visible = true;
  21. //textBox1.Visible = false;
  22. //label4.Visible = false;
  23. }
  24.  
  25. private void button1_Click(object sender, EventArgs e)
  26. {
  27. if (Password.CompareTo(textBox1.Text) == 0)
  28. {
  29. MessageBox.Show("Пароль верный");
  30. textBox1.BackColor = Color.White;
  31. label1.Visible = false;
  32. textBox1.Visible = false;
  33. button1.Visible = false;
  34. }
  35. else
  36. {
  37. k++;
  38. if (k == 3)
  39. {
  40. MessageBox.Show("Попытки закончились");
  41. Close();
  42. }
  43. MessageBox.Show("Пароль не верен");
  44.  
  45. }
  46. }
  47.  
  48. private void label1_Click(object sender, EventArgs e)
  49. {
  50.  
  51. }
  52. private void textBox1_TextChanged(object sender, EventArgs e)
  53. {
  54.  
  55. }
  56. class Man
  57. {
  58. public string Name { get; set; }
  59. string year;
  60. public string Year
  61. {
  62. get { return year; }
  63. set { year = value; }
  64. }
  65. }
  66.  
  67. private void label2_Click(object sender, EventArgs e)
  68. {
  69.  
  70. }
  71.  
  72. private void sizeToolStripMenuItem_Click(object sender, EventArgs e)
  73. {
  74. m = int.Parse(textBox5.Text);
  75. groupSize = new Man[m];
  76. textBox5.Visible = false;
  77. label5.Visible = false;
  78. }
  79.  
  80. private void добавитьToolStripMenuItem_Click(object sender, EventArgs e)
  81. {
  82. if (m == k)
  83. {
  84. MessageBox.Show("Нет места");
  85. return;
  86. }
  87. groupSize[m] = new Man();
  88. groupSize[m].Name = textBox2.Text;
  89. groupSize[m].Year = textBox4.Text;
  90. m++;
  91. textBox2.Text = "";
  92. textBox4.Clear();
  93.  
  94. }
  95.  
  96. private void textBox2_TextChanged(object sender, EventArgs e)
  97. {
  98.  
  99. }
  100.  
  101. private void выводToolStripMenuItem_Click(object sender, EventArgs e)
  102. {
  103. richTextBox1.Text += "\n\t Список товаров \n";
  104. for (int i = 0; i < m; i++)
  105. richTextBox1.Text += "Фамилия : " + groupSize[i].Name + " Год : " + groupSize[i].Year + "\n";
  106. }
  107.  
  108. private void textBox4_TextChanged(object sender, EventArgs e)
  109. {
  110.  
  111. }
  112.  
  113. private void richTextBox1_TextChanged(object sender, EventArgs e)
  114. {
  115.  
  116. }
  117.  
  118. private void label5_Click(object sender, EventArgs e)
  119. {
  120.  
  121. }
  122.  
  123. private void textBox5_TextChanged(object sender, EventArgs e)
  124. {
  125.  
  126. }
  127. }
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement