datagridview输入数据,先判断是否有重复 datagridview没有绑定数据源,就是单纯的向datagridview中输入一行数据,有4列.输入的时候其中一列不能有重复,如果有重复,就提示.没有重复就写入.请问这个是否有重复的判断要怎么写? 希望知道的能讲的详细一点,谢谢各位了... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 遍历datagridview判断是否存在或使用datatable保存判断是否存在,再添加 你是在运行后,手动向dataGridView添加一行的某列时去判断时候有重复吗? 可以循环遍历datatable里面有没有重复的数据 让后再绑定 private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { int count = this.dataGridView1.Rows.Count; if (count > 1 && dataGridView1.CurrentCell.RowIndex>0) { if (this.dataGridView1.CurrentCell.ColumnIndex == 1) { for (int i = 0; i <this .dataGridView1.CurrentCell .RowIndex ; i++) { if (this.dataGridView1.Rows[i].Cells[1].Value.ToString() == this.dataGridView1.Rows [this .dataGridView1 .CurrentCell .RowIndex ].Cells [1].Value .ToString ()) { MessageBox.Show("此值重复了!!!","提示"); break; } } } } } 存储过程用游标把一列数据写成一行 一个action和invoke的问题 未将对象引用设置到对象的实例问题 求c#开发 webgame 网页游戏 的教程和实例 在线等 c#调用0cx问题 高手现身救命吧: datagridview的数据导入到EXCEL 哪位高手有使用.net remoting技术实现的在两台电脑间传递程序的例子? 委托不能 当做泛型参数传吗 在线等 我在DOTNET下用C#写的WinForm程序可否象在vc下静态link把framework编译进来 win7下vs2010运行c#老崩溃 请问如何在ZedGraph中实现股票软件中的全屏坐标左右移动
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
int count = this.dataGridView1.Rows.Count;
if (count > 1 && dataGridView1.CurrentCell.RowIndex>0)
{ if (this.dataGridView1.CurrentCell.ColumnIndex == 1)
{
for (int i = 0; i <this .dataGridView1.CurrentCell .RowIndex ; i++)
{
if (this.dataGridView1.Rows[i].Cells[1].Value.ToString() == this.dataGridView1.Rows [this .dataGridView1 .CurrentCell .RowIndex ].Cells [1].Value .ToString ())
{
MessageBox.Show("此值重复了!!!","提示");
break;
}
}
}
}
}