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.

Add new row in a data table

Thread ID:

Created:

Updated:

Platform:

Replies:

6315 Aug 8,2003 08:29 AM Aug 8,2003 09:21 AM Windows Forms 1
loading
Tags: GridControl
Steli Andrei
Asked On August 8, 2003 08:29 AM

Hi, I have a DataBoundGrid bound to a datatable: dtblParts, and in it I display the following columns: CategoryID, PartID, Price and Quantity. Price column gets populated based on my selection in CategoryID and PartID. What I want now is that when I put in a value for Quantity a TotalPrice to be calculated and displayed somewhere on the form. To do that I do have a routine that checks the number of rows datatable has. Here is the problem: the number of rows is: 0. This is the way I initiate a "New part " operation: dtblParts.rows.Clear dtblParts.rows.AddNew grdParts.DataSource = dtblParts grdParts.Refresh The grid display a new row since the EnableAddNew = True but the datatable behind it does not have any rows. Unless I click on the next row and back in the previous row, I don't get a new row in the data table.

Administrator [Syncfusion]
Replied On August 8, 2003 09:21 AM

> Hi, > I have a DataBoundGrid bound to a datatable: dtblParts, and in it I display the following columns: CategoryID, PartID, Price and Quantity. Price column gets populated based on my selection in CategoryID and PartID. What I want now is that when I put in a value for Quantity a TotalPrice to be calculated and displayed somewhere on the form. To do that I do have a routine that checks the number of rows datatable has. Here is the problem: the number of rows is: 0. > > This is the way I initiate a "New part " operation: > > dtblParts.rows.Clear > dtblParts.rows.AddNew > grdParts.DataSource = dtblParts > grdParts.Refresh > > The grid display a new row since the EnableAddNew = True but the datatable behind it does not have any rows. Unless I click on the next row and back in the previous row, I don't get a new row in the data table. What does > dtblParts.rows.AddNew do? It is not a member of DataTable.Rows, is it. Normally to add a row, you would use code like Dim dr as DataRow = dataTable1.NewRow() ...populate dr ... dataTable1.Rows.Add(dr)

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.

;