Connecting Tech Pros Worldwide Help | Site Map

How to add new records to the top of the DataGrid

dbuchanan
Guest
 
Posts: n/a
#1: Nov 29 '05
Hello,

I am using Win forms VB 2003

The form design requires the newest records appear at the top of the
DataGrid.

I load my form with a stored procedure that orders the records with the
newest one on top of the DataGrid.

New records are added by the user by filling out the controls on the
form and clicking the 'Add' button. When the new record is added to the
DataGrid it appears at the bottom of all the records.

To put the new record back on top I am embarrassed to say that I added
code to the 'Add' (save) button that goes to the trouble of clearing
the DataGrid, and form and emptying the dataset. Then it reloads the
form.

What is the correct way to get new records to be added to the top of
the datagrid?

Thank you,
dbuchanan

Nassos
Guest
 
Posts: n/a
#2: Nov 29 '05

re: How to add new records to the top of the DataGrid


thi only way that i know of, is build a new DataSet add the first row you
want and add the rest after and finally assing it to the datasource of the
grid
hope that helps

"dbuchanan" <dbuchanan52@hotmail.com> wrote in message
news:1133267949.530495.138860@z14g2000cwz.googlegr oups.com...[color=blue]
> Hello,
>
> I am using Win forms VB 2003
>
> The form design requires the newest records appear at the top of the
> DataGrid.
>
> I load my form with a stored procedure that orders the records with the
> newest one on top of the DataGrid.
>
> New records are added by the user by filling out the controls on the
> form and clicking the 'Add' button. When the new record is added to the
> DataGrid it appears at the bottom of all the records.
>
> To put the new record back on top I am embarrassed to say that I added
> code to the 'Add' (save) button that goes to the trouble of clearing
> the DataGrid, and form and emptying the dataset. Then it reloads the
> form.
>
> What is the correct way to get new records to be added to the top of
> the datagrid?
>
> Thank you,
> dbuchanan
>[/color]


dbuchanan
Guest
 
Posts: n/a
#3: Nov 29 '05

re: How to add new records to the top of the DataGrid


Thank you Nassos.

Anyone else have any ideas.

dbuchanan

Closed Thread