public virtual int FindMatchingRow(string text, int start, SearchDirectionHint direction)
{
// We also can't do anything if we don't have data
int rowCount = this.GetItemCount();
if (rowCount == 0)
return -1;
// Which column are we going to use for our comparing?
OLVColumn column = this.GetColumn(0);
if (this.IsSearchOnSortColumn && this.View == View.Details && this.LastSortColumn != null)
column = this.LastSortColumn;
// Do two searches if necessary to find a match. The second search is the wrap-around part of searching
int i;
if (direction == SearchDirectionHint.Down) {
i = this.FindMatchInRange(text, start, rowCount - 1, column);
if (i == -1 && start > 0)
i = this.FindMatchInRange(text, 0, start - 1, column);
} else {
i = this.FindMatchInRange(text, start, 0, column);
if (i == -1 && start != rowCount)
i = this.FindMatchInRange(text, rowCount - 1, start + 1, column);
}
return i;
}