Formumuzda birden fazla checkbox var ise seçili olan checkbox’ı yazdıran örnek ……..
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 WindowsFormsApplication3
{
public partial class chkbox : Form
{
public chkbox()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string s = “”;
foreach (Control k in this.Controls)
{
if (k is CheckBox)
{
CheckBox chk = (CheckBox)k;
if(chk.Checked)
s = chk.Text + s;
}
}
MessageBox.Show(s);
}
}
}