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.
Unfortunately, activation email could not send to your email. Please try again.

CurrentCell.MoveTo After Inserting Row

Thread ID:

Created:

Updated:

Platform:

Replies:

20343 Oct 14,2004 10:39 AM Oct 14,2004 01:15 PM Windows Forms 4
loading
Tags: GridControl
Jeff Lancaster
Asked On October 14, 2004 10:39 AM

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 11:14 AM

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 11:44 AM

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 01:07 PM

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 01:15 PM

Thanks Clay, that worked.

CONFIRMATION

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.

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.

;