Solved

Point datagridview row while it is added.

Posted on 2010-09-04
5
384 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33602521
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
ID: 33602578
after you add the new row ...set Me.datagridview.CancelEdit
0
 
LVL 18

Expert Comment

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

Accepted Solution

by:
Zhaolai earned 500 total points
ID: 33605508
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
ID: 33608691
Hi Zhaolai,

It works.

Thank you very much for your help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

688 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