Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace WindowsFormsApplication2
- {
- public partial class Form1 : Form
- {
- List<string> Perebor(GroupBox groupBox)
- {
- List<string> value = new List<string>();
- foreach (Control control in groupBox.Controls)
- {
- if (control.GetType() == typeof(CheckBox))
- {
- CheckBox checkBox = (CheckBox)control;
- if (checkBox.Checked == true)
- value.Add(checkBox.Text);
- }
- else if (control.GetType() == typeof(RadioButton))
- {
- RadioButton radioButton = (RadioButton)control;
- if (radioButton.Checked == true)
- value.Add(radioButton.Text);
- }
- }
- return value;
- }
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- foreach (string text in Perebor(groupBox1))
- { textBox1.Text = text; }
- }
- }
- textBox1.Text = text;
- textBox1.Text += text + ";";
Add Comment
Please, Sign In to add comment