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

Inserting row in datatable with InsertAt(), appends as last row in table

Thread ID:





1408 Oct 24,2002 12:17 PM UTC Oct 25,2002 04:43 AM UTC WinForms 1
Tags: FAQ
Fredrik Andersson
Asked On October 24, 2002 12:17 PM UTC

Say I have five rows in my DataTable (dtView) that has columns named "icon", "name" and "value". I want to get data from custom columns and rows of another DataTable (dtStyles) and insert it at row 3 in dtView, then I do like this: Dim dr As DataRow dr = dtView.NewRow dr(0) = System.String.Format("") dr(1) = dtStyles.Rows(RowNr).Item("displayname") dr(2) = dtStyles.Rows(RowNr).Item("value") dtView.Rows.InsertAt(dr, 3) -- This code results in an dtView DataTable where the new inserted row is appended as the last row, even thogh i have atleast 5 rows in my table and is inserting the new one at possition 3. What am I doing wrong?

Administrator [Syncfusion]
Replied On October 25, 2002 04:43 AM UTC

After calling the InsertAt, try calling dtView.AcceptChanges() to see if that will place the row properly in your table.


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