Dave,
>I have a simple maintenance form (
http://www.zmsi.com/Grab52.png ).
>The table has 15,000 plus records in it and I'm trying to figure out a way to quickly locate a record. I put a mmpicker on the form and I have the picker working. Working in that it is returning the primary key value for the record found. What I want to do is move to the grid and find the record in the grid returned by the picker. OR some other idea or easier way to locate a record the grid...
Here is the code for mmPickListForm that does incremental searching in grids using the Windows Forms Currency Manager. You can steal from this code to find and select a specific row in a DataGrid:
int RowID = -1;
if (!mmString.Empty(this.txtSearch.Text))
{
CurrencyManager cm = this.grdPickList.GetCurrencyManager();
DataView dv = (DataView)cm.List;
DataTable dt = dv.Table;
DataRow[] rows = dt.Select(string.Format(this.SortColumnField + " like '{0}%'", this.txtSearch.Text), dv.Sort);
if (rows.Length > 0)
{
RowID = dv.Find(rows[0][this.SortColumnField]);
}
}
this.grdPickList.ClearSelectedRows();
if (RowID >= 0)
{
this.grdPickList.SelectRow(RowID);
this.grdPickList.CurrentRowIndex = RowID;
}
else
{
this.grdPickList.CurrentRowIndex = 0;
this.grdPickList.ClearSelectedRows();
}
Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com