How to read/write cellvalues programettically


#1

I have a winform application, where I am using Griddesktop to display an Excel file. I have the need to programetically change the contents but the changes are not reflected in the Griddesktop Control.
I have attached a small example, where I am trying til insert a value to a cell, but the changes are not reflected in the desktop…WindowsFormsApp1.zip (12.3 KB)


#2

@PELLE42,

Thanks for the sample project and details.

Please add a line to your code segment (see the line in bold), it will work as expected as I tested:
e.g
Sample code:


private void Form1_Load(object sender, EventArgs e)
{
_wbBook = new GridDesktop();
_wbBook.Dock = DockStyle.Fill;
_wbBook.Worksheets.Clear();
_wbBook.CellDataChanged += _wbBook_CellDataChanged;
_sheet = _wbBook.Worksheets.Add(“Test”);
panel1.Controls.Add(_wbBook);
var cell = _sheet.Cells[“A1”];
cell.Value = 1234;
_wbBook.RefreshControl();

    } 

Let us know if you still find any issue.