void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
if (e.ColumnIndex == dataGridView1.Columns["MyCombo"].Index)
{
var query = from DataGridViewRow row in dataGridView1.Rows
where row.Cells[e.ColumnIndex].Value != null && row.Cells[e.ColumnIndex].Value.ToString() == e.FormattedValue.ToString()
where row.Index != e.RowIndex
select row;
if (query.Any())
{
MessageBox.Show(string.Format("{0} already exists", e.FormattedValue.ToString()));
e.Cancel = true;
}
}
}
Wednesday, 30 October 2013
How to Check Duplicate Item Names in Data Grid
Subscribe to:
Post Comments (Atom)
SQL SERVER – Disk Space Monitoring – Detecting Low Disk Space on Server
CREATE PROCEDURE [CSMSDVLP].[DiskSpaceMonitor] @mailProfile nvarchar(500), @mailto nvarchar(4000), @threshold INT, @logfile nvarchar(40...
-
Row grouping in DataGridView using winforms Here is a custom DataGridView that you add to your project, compile, add the DataGridView...
-
HTML Markup The HTML Markup consists of an ASP.Net GridView with three columns populated from the Customers Table of the Northwind Datab...
No comments:
Post a Comment