Sheldon,
>I set up a Business maintenance form.
>
>After sorting the list by clicking the column header. the NEW button will no longer bring up a blank record, instead, it brings up the last record in the list. The button works just fine if user doesn't sort the list before that.
I'm guessing that the new record DOES appear in the grid (you should see it if you scroll up) but it's no longer the last row because of the new sort order. To get around this, you need to bind your DataGrid to a DataView rather than the DataTable. For example:
BindingSource: Orders
BindingSourceMember: Orders.DefaultView
You should also set these binding properties on your New button. Now the problem is determining whether the new row is added as the first row or the last row (depending on how the grid is sorted), and then navigate to that row. To do this, override your form's NavigateNew() method. For example:
public override void NavigateNew()
{
string SortOrder = ((DataView)this.grdCustomerOrders.DataSource).Sort;
if (mmString.Empty(SortOrder))
{
this.NavigateData(mmNavigate.Last, false);
}
else
{
}
}
Best 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