doing some user interface restriction on my c sharp project. using visual studio 2008 and C#.net.
So I have a little bit of code, its a nested for loop that should run through the columns rows and check if there's a duplicate.
Thinking about it I should change the text to an array that I can print out since there can be more than 1 duplicate.
Simply put, there is a league of parts, incrementing by one to be unique. The user wish's to change the league parts, some go up some go down.
here's what I have so far.
public void CheckForDuplicate()
{
DataGridViewRowCollection coll = ParetoGrid.Rows;
DataGridViewRowCollection colls = ParetoGrid.Rows;
foreach (DataGridViewRow item in coll)
{
foreach (DataGridViewRow items in colls)
{
if (items.Cells[5].Value == item.Cells[5].Value)
{
if(items.Cells[2].Value != item.Cells[2].Value)
{
txtDupe.Text = items.Cells[2].Value.ToString();
this.Refresh();
dupi = false;
}
}
}
}
}
Nothing happens, nothing at all seems it's always false. some odd reason debugging isn't catching anything. So I'm wandering if there's a silly one liner I've missed out, or if theres a much better way to do it?
Many thanks!