Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Point datagridview row while it is added.

Posted on 2010-09-04
5
Medium Priority
?
388 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 2000 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

636 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