Objective Grid: Editing the record in the data source

Article ID: 317
Last updated: 11 Jun, 2018
Article ID: 317
Last updated: 11 Jun, 2018
Revision: 3
Views: 1757
Posted: 12 Jan, 2001
by Meltreger B.
Updated: 11 Jun, 2018
by Meltreger B.

Problem


How can I programmatically edit a record in the data source?


Cause



Action


The following sample code shows you how you can programmatically change a record to your data source.

Example:

// Change the contents of nRow in the grid.
if (CanUpdate())
{
// Enter edit-mode
Edit(nRow);

// Lock updating the grid
BOOL bLock = LockUpdate(TRUE);

SetValueRange(CGXRange(nRow, 1), "1");
SetValueRange(CGXRange(nRow, 2), "2");

// Unlock painting
LockUpdate(bLock);

// Flush pending changes, Update will
// also redraw the row.
Update();

}

Please note that this code depends only on CGXBrowserGrid-functionality and thus makes appending rows independent from your specific data source. You can use the same code for appending a row to a ADO recordset, ODBC recordset or any other external data source.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 317
Last updated: 11 Jun, 2018
Revision: 3
Views: 1757
Posted: 12 Jan, 2001 by Meltreger B.
Updated: 11 Jun, 2018 by Meltreger B.

Others in this category