We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

CurrentCell.MoveTo After Inserting Row

Thread ID:





20343 Oct 14,2004 02:39 PM UTC Oct 14,2004 05:15 PM UTC WinForms 4
Tags: GridControl
Jeff Lancaster
Asked On October 14, 2004 02:39 PM UTC

After inserting a row in my databound grid I am trying to move the current cell back one line into the current cell. Although I am inserting a blank record into the data, after the current cell is moved, the data from the previous currentcell shows in my new currentcell. However, if I then move off the new currentcell and then back it shows up blank like it should. The code I''m using follows. How can I prevent this from happening? Public Sub insertRow() Dim row As Integer = m_grid.CurrentCell.RowIndex Dim col As Integer = m_grid.CurrentCell.ColIndex dtaProducts.GenProductsCollection.Insert(row - 1, New CGenProductsPricingInfo) m_grid.CurrentCell.MoveTo(row, col) End Sub

Administrator [Syncfusion]
Replied On October 14, 2004 03:14 PM UTC

You will not be able to insert rows into a datatable. You can only add them at the end using DataTable.AddNew. If you need to rearrange the rows, then you can try to set up a DataView ordered on some hidden field that makes the rows appear in the order that you want them. But this will take some work to do.

Jeff Lancaster
Replied On October 14, 2004 03:44 PM UTC

Actually, I am able to insert rows, as I am not bound to a datatable, I am bound to a custom collection implementing iBindingList. I have an insert function which works, it inserts a blank record and the grid is automatically syncing and properly showing the new blank record in the right row. The problem is, when I use the CurrentCell.Moveto, so as to reposition the highlighter into the new row, it appears to be displaying the data from the old current cell in the new one. If I click off the new current cell and then back on it displays properly.

Administrator [Syncfusion]
Replied On October 14, 2004 05:07 PM UTC

Before you insert the row, try calling this.grid.CurrentCell.EndEdit() to see if this handles thie problem.

Jeff Lancaster
Replied On October 14, 2004 05:15 PM UTC

Thanks Clay, that worked.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon