Advertisement
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.Threading.Tasks;
- using System.Windows.Forms;
- namespace Tutorial
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void radioButton1_Click(object sender, EventArgs e)
- {
- Desativar(this, "textBox1");
- }
- private void radioButton2_Click(object sender, EventArgs e)
- {
- Desativar(this, "textBox2");
- }
- private void radioButton3_Click(object sender, EventArgs e)
- {
- Desativar(this, "textBox3");
- }
- private void Desativar(Form f, String nomeComponente)
- {
- foreach (Control c in f.Controls)
- {
- if (c is TextBox)
- {
- if (c.Name == nomeComponente)
- c.Enabled = true;
- else
- c.Enabled = false;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement