Solved

Point datagridview row while it is added.

Posted on 2010-09-04
5
382 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
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

791 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