Solved

Point datagridview row while it is added.

Posted on 2010-09-04
5
373 Views
Last Modified: 2012-06-21
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

0
Comment
Question by:emi_sastra
  • 3
5 Comments
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
Comment Utility
Hi emi...
you mean that always there is a new row (empty) after you add yours?
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
Comment Utility
after you add the new row ...set Me.datagridview.CancelEdit
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
Comment Utility
use :
 Me.MyDataGridView.Rows(Me.MyDataGridView.Rows.Count - 1).Selected = True
0
 
LVL 17

Accepted Solution

by:
Zhaolai earned 500 total points
Comment Utility
Try switching two of the lines and adding DoEvents:


Dim row As DataRow = dtResult.NewRow()



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

Me.dgvHasilProses.Refresh()

Application.DoEvents()

row("Id") = strEmpCode

row("DateLog") = dteDateLog.ToString("dd MMM yyyy")



dtResult.Rows.Add(row)

Open in new window

0
 
LVL 1

Author Comment

by:emi_sastra
Comment Utility
Hi Zhaolai,

It works.

Thank you very much for your help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now