checkbox type in Data grid view
باسلام خدمت اساتید محترم،
میخواستم بدونم چطور میشه چک کرد که در یک Datagrid view که یکی از ستون هاش از نوع checkbox هستش کدوم چک باکس (ها) تیک خورده؟
راستش من از کد:
نقل قول:
foreach (CheckBox cb in clmnDelete)
{
if(cb.Checked == true)
if (MessageBox.Show("پیغام")
== DialogResult.OK)
{
{
استفاده کردم ولی error زیر رو میده:
Error 1 foreach statement cannot operate on variables of type 'System.Windows.Forms.DataGridViewCheckBoxColumn' because 'System.Windows.Forms.DataGridViewCheckBoxColumn' does not contain a public definition for 'GetEnumerator' formContractor.cs 109 13 Application
ممنونم اگه راهنمایی بفرمایید.
نقل قول: checkbox type in Data grid view
با سلام.
از دستور زیر میتونی استفاده بکنی :
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if (row.Cells[1].Value != null)
{
if ((Boolean)row.Cells[1].Value)
{
listBox1.Items.Add(row.Cells[0].Value);
}
}
}