| Home | Previous Lesson: Retrieving Data from the Database Next Lesson: Deleting a Row from the DataWindow |
// Object: cb_add in w_product_master window // Event: clicked Long ll_InsertedRow ll_InsertedRow = dw_product.InsertRow(0) dw_product.ScrollToRow(ll_InsertedRow) |
The row number returned by the InsertRow() function is of long data type and represents the row number of the new record. Using the zero parameter for the InsertRow() adds (appends) the new row to the end of the result set. Any non-zero parameter to the InsertRow() would add a blank row just before the row number specified as the parameter. Even though a new row is added to the DataWindow, by default, the cursor remains where it was. Hence, you need to call the ScrollToRow() function to scroll to the newly added row.
In case you can't see the new blank row, go the DataWindow painter and open d_product_maint and paint borders for every column and save the DataWindow and comeback (run the application).
| Home | Previous Lesson: Retrieving Data from the Database Next Lesson: Deleting a Row from the DataWindow |