Guest User

Untitled

a guest
Apr 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace WindowsFormsApplication2
  11. {
  12. public partial class Form1 : Form
  13. {
  14.  
  15. List<string> Perebor(GroupBox groupBox)
  16. {
  17. List<string> value = new List<string>();
  18. foreach (Control control in groupBox.Controls)
  19. {
  20. if (control.GetType() == typeof(CheckBox))
  21. {
  22. CheckBox checkBox = (CheckBox)control;
  23. if (checkBox.Checked == true)
  24. value.Add(checkBox.Text);
  25. }
  26. else if (control.GetType() == typeof(RadioButton))
  27. {
  28. RadioButton radioButton = (RadioButton)control;
  29. if (radioButton.Checked == true)
  30. value.Add(radioButton.Text);
  31. }
  32. }
  33. return value;
  34. }
  35.  
  36.  
  37. public Form1()
  38. {
  39. InitializeComponent();
  40. }
  41.  
  42. private void button1_Click(object sender, EventArgs e)
  43. {
  44.  
  45. foreach (string text in Perebor(groupBox1))
  46. { textBox1.Text = text; }
  47. }
  48. }
  49.  
  50. textBox1.Text = text;
  51.  
  52. textBox1.Text += text + ";";
Add Comment
Please, Sign In to add comment