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 ControlAddHandler
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- foreach (Control control in this.Controls)
- {
- if (control is RadioButton)
- {
- ((RadioButton)control).CheckedChanged += radioButton_CheckedChanged;
- }
- }
- }
- private void radioButton_CheckedChanged(object sender, EventArgs e)
- {
- switch (int.Parse(((RadioButton)sender).Name.Replace("radioButton", string.Empty)))
- {
- case 1:
- case 2:
- case 6:
- case 7:
- case 9:
- case 11:
- case 12:
- comboBox1.Enabled = true; break;
- default:
- comboBox1.Enabled = false; break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment