Question : get datagridview to show last record instead of first.

Hi,
I was wondering is it possible to get the DATAGRID VIEW to show the last record instead of the first when it is initially loaded.

I am using VB.net with a Windows Form to display a table from Access 2003.
Code Snippet:
1:
2:
3:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DataSet2.tblBeverages' table. You can move, or remove it, as needed.
        Me.TblBeveragesTableAdapter.Fill(Me.DataSet2.tblBeverages)

Answer : get datagridview to show last record instead of first.

FirstDisplayedScrollingRowIndex  is just the first row to appear/displays in the datagridview. You can do :
DataGridView.FirstDisplayedScrollingRowIndex  = 3

Where 3 is the index. If you want the last number you can use:
DataGridView.FirstDisplayedScrollingRowIndex  = DataGridView.RowCount -1

But this does not select the record. To select the record you can use
Me.DataGridView.Rows(3).Selected = True


Random Solutions  
 
programming4us programming4us