本帖最后由 zhongdecai 于 2009-07-09 13:50:28 编辑

解决方案 »

  1.   

    第一个问题,在你的数据源里面添加一列Bool类型的数据源就行了
    第二个可以根据条件把数据删了,在把datagridview里面的数据循环添加到数据库中,或者用sqlcommandbuilder
    第三个,循环判断是否选中
    this.datagirdview.rows[1].cells[0].value.tostring().equals("true")//选中
      

  2.   

    lsj_zrp回答的很好了, 至于DataGridView控件使用可以参考C# WinForm开发系列 - DataGridView 
      

  3.   

    呵呵,web用过,估计差不多吧。
      

  4.   

    以下方法判断是否选中
    其中chkClient是checkbox的namepublic bool IsNoChecked()
            {
                bool temp = false; 
                for (int count = 0; count < this.dgvCommon.Rows.Count; count++)
                {
                    DataGridViewCheckBoxCell cbh = (DataGridViewCheckBoxCell)this.dgvCommon.Rows[count].Cells["chkClient"];
                    if (cbh != null && (bool)cbh.FormattedValue)
                    {
                        temp = true;
                        break;
                    }
                }
                return temp;
            }
      

  5.   

    以下是一个删除前询问以及循环判断应该删除选中的项(一项多项都可以)public void deleteClientFun()
            {
                if (MessageBoxYesCancel("确定删除选中客户吗?删除后无法恢复!") == DialogResult.OK)
                {
                    for (int count = 0; count < this.dgvCommon.Rows.Count; count++)
                    {
                        DataGridViewCheckBoxCell cbh = (DataGridViewCheckBoxCell)this.dgvCommon.Rows[count].Cells["chkClient"];
                        if (cbh != null && (bool)cbh.FormattedValue)
                        {
                            你的删除方法
                        }
                    }
                    datagridview1的重新绑定
                }
            }
    最后这个是询问公共对话框public static DialogResult MessageBoxYesCancel(string Information)//通用弹出式信息显示对话框方法(进行互操作)返回黄色感汉号
            {
                string caption = "【系统提示】";
                MessageBoxButtons buttons = MessageBoxButtons.OKCancel;
                return MessageBox.Show(Information, caption, buttons, MessageBoxIcon.Question);
            }
      

  6.   

     至于你的第二个问题
    2,可以直接保存DATAGRIDVIEW里面的内容
    给你一个贴子你看看吧:
    http://blog.csdn.net/zushao0124/archive/2007/05/02/1594985.aspx