Home Forums WinForms controls Xceed Grid for WinForms DataSource update problem Reply To: DataSource update problem

User (Old forums)
Post count: 23064

You subscribe to the ValueChanged-event in the button1_Click method. I think you should do that only once, and not each time you click the button. So move that code out of the button1_Click, and into the constructor of your form, after the call to InitializeComponent, like this:<code>public Form1() {
EventHandler handler = new EventHandler(cellValueChanged);
foreach(DataCell cell in gridControl1.DataRowTemplate.Cells)
cell.ValueChanged += handler;
Secondly, I think you should change your mechanism: it’s better to just bind the grid to a DataSet only once, and then update the existing DataSet instead of creating a new DataSet each time. I used to do this (create new one each time) for one of our smaller internal tools, but that tool got bigger and bigger and now we have to rewrite it because it has become too slow.

Imported from legacy forums. Posted by Tommy (had 312 views)