B
Benton
Hi there,
I have this method to search a DataView:
public int FindIndex(string columnName, object key)
{
index = -1;
foreach (DataRowView drv in table.DefaultView)
{
if (drv[columnName].Equals(key))
{
index = i;
break;
}
i++;
}
return index;
}
So far this does not work:
int i = FindIndex("IDFIELD", textBox1.Text); <= I get a -1
However, this does work ok:
string search = textBox1.Text;
int i = SearchIndex("IDFIELD", Convert.ToInt32(textBox1.Text));
In this case I get the correct index.
Any ideas?
Regards,
-Benton
I have this method to search a DataView:
public int FindIndex(string columnName, object key)
{
index = -1;
foreach (DataRowView drv in table.DefaultView)
{
if (drv[columnName].Equals(key))
{
index = i;
break;
}
i++;
}
return index;
}
So far this does not work:
int i = FindIndex("IDFIELD", textBox1.Text); <= I get a -1
However, this does work ok:
string search = textBox1.Text;
int i = SearchIndex("IDFIELD", Convert.ToInt32(textBox1.Text));
In this case I get the correct index.
Any ideas?
Regards,
-Benton