没有合适的资源?快使用搜索试试~ 我知道了~
DataGridView数据源绑定
![star](https://csdnimg.cn/release/downloadcmsfe/public/img/star.98a08eaa.png)
温馨提示
DataGridView的常见操作源码,包含数据源绑定,添加删除修改选中单元格删除修改等等
资源推荐
资源详情
资源评论
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
UserAction uAction = new UserAction();
private void DGVDataTest_Load(object sender, EventArgs e)
{
ArrayList arrayList = new ArrayList();
arrayList = uAction.QueryPageList(1).getPage();
dataGridView1.ReadOnly = true;
bindingSource1.DataSource = arrayList;
dataGridView1.DataSource = bindingSource1;
//dataGridView1.DefaultCellStyle.SelectionBackColor = Color.Black;
this.dataGridView1.RowsDefaultCellStyle.BackColor = Color.Bisque;
this.dataGridView1.AlternatingRowsDefaultCellStyle.BackColor =
Color.Beige;
}
//选中行删除
private void button2_Click(object sender, EventArgs e)
{
/*
int selectIndex = dataGridView1.SelectedRows.Count;
if (selectIndex == 1)
{
if (MessageBox.Show("您确定"+dataGridView1.SelectedRows[0].Cells[0].Value.ToString(), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
bindingSource1.RemoveAt(this.dataGridView1.SelectedRows[0].Index);
}
}
else if (MessageBox.Show("您确定" + selectIndex, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
private void DGVDataTest_Load(object sender, EventArgs e)
{
ArrayList arrayList = new ArrayList();
arrayList = uAction.QueryPageList(1).getPage();
dataGridView1.ReadOnly = true;
bindingSource1.DataSource = arrayList;
dataGridView1.DataSource = bindingSource1;
//dataGridView1.DefaultCellStyle.SelectionBackColor = Color.Black;
this.dataGridView1.RowsDefaultCellStyle.BackColor = Color.Bisque;
this.dataGridView1.AlternatingRowsDefaultCellStyle.BackColor =
Color.Beige;
}
//选中行删除
private void button2_Click(object sender, EventArgs e)
{
/*
int selectIndex = dataGridView1.SelectedRows.Count;
if (selectIndex == 1)
{
if (MessageBox.Show("您确定"+dataGridView1.SelectedRows[0].Cells[0].Value.ToString(), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
bindingSource1.RemoveAt(this.dataGridView1.SelectedRows[0].Index);
}
}
else if (MessageBox.Show("您确定" + selectIndex, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
![avatar](https://profile-avatar.csdnimg.cn/45828f8d49874054bec8d5a8de1c9462_jsprenwayle.jpg!1)
影木荣贵
- 粉丝: 1
- 资源: 20
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
- 1
- 2
前往页