Hi there. i got the code for a type of search, incremental if im not mistaken but when i press find, it finds the first instance of what was typed in the textbox but i want it to be like, If you press find again it takes you to the next row containing the same value.
any help?
Here is my code:
private int GetRowHandleByC olumnValue(Grid View view, string ColumnFieldName , object value)
{
string columnName = ColumnFieldName ;
int result = GridControl.Inv alidRowHandle;
for (int i = 0; i < view.RowCount; i++)
if (view.GetDataRo w(i)[columnName].Equals(value))
return i;
return result;
}
private void btnFind_Click(o bject sender, System.EventArg s e)
{
int rowHandle = GetRowHandleByC olumnValue(gvAs sets, "AST__CODE" , txtFind.Text);
if (rowHandle != GridControl.Inv alidRowHandle)
{
gvAssets.Focuse dColumn = gvAssets.Column s.ColumnByField Name("AST__CODE ");
gvAssets.Focuse dRowHandle = rowHandle;
if (gvAssets.IsRow Visible(rowHand le) == RowVisibleState .Hidden)
gvAssets.MakeRo wVisible(rowHan dle, false);
gvAssets.ShowEd itor();
}
else
MessageBox.Show ("Not found!");
}
any help?
Here is my code:
private int GetRowHandleByC olumnValue(Grid View view, string ColumnFieldName , object value)
{
string columnName = ColumnFieldName ;
int result = GridControl.Inv alidRowHandle;
for (int i = 0; i < view.RowCount; i++)
if (view.GetDataRo w(i)[columnName].Equals(value))
return i;
return result;
}
private void btnFind_Click(o bject sender, System.EventArg s e)
{
int rowHandle = GetRowHandleByC olumnValue(gvAs sets, "AST__CODE" , txtFind.Text);
if (rowHandle != GridControl.Inv alidRowHandle)
{
gvAssets.Focuse dColumn = gvAssets.Column s.ColumnByField Name("AST__CODE ");
gvAssets.Focuse dRowHandle = rowHandle;
if (gvAssets.IsRow Visible(rowHand le) == RowVisibleState .Hidden)
gvAssets.MakeRo wVisible(rowHan dle, false);
gvAssets.ShowEd itor();
}
else
MessageBox.Show ("Not found!");
}
Comment