Link to home
Start Free TrialLog in
Avatar of emi_sastra
emi_sastra

asked on

Point datagridview row while it is added.

Hi All,

I add data to datagridview via datatable as datasource.

I want to show to user its progress while added to it.

Please see below code, the purpose is work, but always left behind one row.
I mean while pointer point to row one, the second row data is already added.

How could I do it?

Thank you.
Dim row As DataRow = dtResult.NewRow()

        Me.dgvHasilProses.Refresh()

        ERV_Global.Locate_DataGridView_Row(dgvHasilProses, dtResult.Rows.Count - 1)

        row("Id") = strEmpCode
        row("DateLog") = dteDateLog.ToString("dd MMM yyyy")
       
        dtResult.Rows.Add(row)

Open in new window

Avatar of John (Yiannis) Toutountzoglou
John (Yiannis) Toutountzoglou
Flag of Greece image

Hi emi...
you mean that always there is a new row (empty) after you add yours?
after you add the new row ...set Me.datagridview.CancelEdit
use :
 Me.MyDataGridView.Rows(Me.MyDataGridView.Rows.Count - 1).Selected = True
ASKER CERTIFIED SOLUTION
Avatar of Zhaolai
Zhaolai
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of emi_sastra
emi_sastra

ASKER

Hi Zhaolai,

It works.

Thank you very much for your help.