views:

2334

answers:

5

i donno how to set focus point always to the new row in datagridview in the beginning??

A: 

Have a look at the CurrentCell property.

RichardOD
can give some example for me???Because i just start to learn vb.net...Thanks a lot, richardOD...
Modify your question with some sample code of what you are doing.
RichardOD
A: 

You want to handle the RowsAdded event of your DataGridView and just select the newly added row.

Private Sub MyDataGridView_RowsAdded(ByVal sender As Object, ByVal e As DataGridViewRowsAddedEventArgs) Handles MyDataGridView.RowsAdded
     MyDataGridView.Rows(e.RowIndex).Selected = true;
End Sub
James
thanks a lot....i try again..thanks
A: 

If (DgViewCityMaster.Rows.Count > 0) Then DgViewCityMaster.Rows(0).Selected = True End If

' Here DGViewCityMaster is my Data Grid View

the
A: 

To focus on the newly added row :-

dataGridView1.Rows[dataGridView1.Rows.Count - 1].Selected = true;

or you can use this to focus on userdefine row

dataGridView1.Rows[Rowindex].Selected = true;

Keep Coding

A: 

dim NoRow As Integer = 2 me.gridTickets.CurrentCell = me.gridTickets.Rows(NoRow).Cells(0)

Adios Amigo!! From: Mexicali, Baja California, México.

RayDelfin