久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

DataGridView的復(fù)選框列的選中事件:DataGirdCheckBoxColumn...

 coding 2010-08-02

DataGridView的復(fù)選框列的選中事件:DataGirdCheckBoxColumn 列 選中 事件,。

       今天在winform下使用DataGridView時(shí),,使用了checkbox列,。一般我們可以通過一個(gè)按鈕的單擊事件中,來判斷該列是否被選中,。但這樣似乎不太人性化,。因此改為當(dāng)checkbox被選中時(shí),執(zhí)行任務(wù),。
       可別小看了這個(gè)問題,。我試了很多的datagridview事件,比如 cellClick CellContentChanged 等事件,,要不就是無法撲捉,,要不就是得到的值為選中前的值:false 。
   
   當(dāng)然,,最后無意找到了正確的事件:cellContentClick 事件,。在該事件中可得知選中前后的值,代碼如下:
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        
{
            
if (e.ColumnIndex == 3 && Convert.ToInt32(tbCpiName.Tag)>0 )//當(dāng)單擊復(fù)選框,,同時(shí)處于組合編輯狀態(tài)時(shí)
            {
                DataGridViewCell cell 
= dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
                
bool ifcheck1 = Convert.ToBoolean(cell.FormattedValue);
                
bool ifcheck2 = Convert.ToBoolean(cell.EditedFormattedValue);

                
if (ifcheck1 != ifcheck2)
                
{
                    BCItem bcitem 
= new BCItem();
                    bcitem.B_bciID 
= Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["bciID"].Value);
                    bcitem.C_CpiID 
= Convert.ToInt32(tbCpiName.Tag);

                    
if (ifcheck2)//將該項(xiàng)目與組合關(guān)聯(lián)
                    {
                        bllcp.AddCompageAndItem(bcitem);
//關(guān)聯(lián)
                    }

                    
else
                    
{
                        bllcp.DeleteCompageAndItem(bcitem);
//取消關(guān)聯(lián)
                    }

                }

            }

        }

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多