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. Image for the cookie policy date

Save content of gridControl1

Hello, everyone

I have to check content of gridControl1, before I'm saving it. If I do Label1.Focus() so everything works well. In the second time it shows the value after the first check and before the second one.

For example,

Original value of gridControl1(5, 5).CellValue is 1000

First check:
gridControl1(5, 5).CellValue = 1
Label1.Focus()
Messagebox.Show("Output - " + gridControl1(5, 5).CellValue) 'Output - 1

gridControl1(5, 5).CellValue = 2
Label1.Focus()
Messagebox.Show("Output - " + gridControl1(5, 5).CellValue) 'Output - 1

The output remains "Output - 1" instead of "Output - 2
"


It makes the same results with Text property (gridControl1(2, 2).Text = 1....)

Regards, and thanks in advance :)
Allon

6 Replies

AL Allon September 23, 2009 10:25 AM UTC

P.S

Everything works fine, just if I click another cell and then make the checking.

Regards,
Allon


RC Rajadurai C Syncfusion Team September 24, 2009 04:45 AM UTC

Hi Allon,

Thanks for your interest in Syncfusion Products.

From the code provided, it seems you were trying to change the cellvalue to 1 and then 2. I have created a sample handling this code snippet in a button1_Click() event. It works as expected. Here it was attached for your reference.
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/F90247.zip

If it seems i misunderstood your requirement, please let me clear by modifying this sample implementing the requirement or issue and update.

Regards,
Rajadurai


AL Allon September 24, 2009 05:54 AM UTC

Rajadurai, Thanks for the little app you sent me.

I had to send a more specific example to demonstrate the problem.
The problem occurred when using a mouse and a keyboard.

The updated example:

Original value of gridControl1(5, 5).CellValue is 1000.

First check:
I click gridControl1(5, 5) with the mouse, and press "1" with the keyboard.

Messagebox.Show("Output - " + gridControl1(5, 5).CellValue) 'Output - 1

(This what should be, and everything's fine...)

Second check (the app is still running):
I click gridControl1(5, 5) with the mouse, and press "2" with the keyboard.

Messagebox.Show("Output - " + gridControl1(5, 5).CellValue) 'Output - 1

(The output remains "Output - 1" instead of "Output - 2)

My question is if I need to use an event similiar to gridControl1.CellValueChanged to change the CellValue property of this cell, and if not, how can I know the current
CellValue or Text, without click another cell of gridControl1 or any other control
in the app.

It made me :) to receive app example, and I hope you'll continue to send me examples, until we fix this problem.

Regards, and have a nice day :)
Allon


P.S

The same problem occurred with Text property.


RC Rajadurai C Syncfusion Team September 24, 2009 06:28 AM UTC

Hi Allon,

Thanks for your details.

While the cell is in editing mode, the changes made after start editing that cell and before leaving that cannot get saved in GridData. Once the editing is complete, the changed cellvalue get updated in it. It is a general behavior followed with gridcells. If you would like to reflect the change made in the cell immediately without leaving that cell, you can call ConfirmChanges() method. Here is the code handled in CurrentCellChanged event for your reference.

Me.gridControl1.CurrentCell.ConfirmChanges()
MessageBox.Show("Output - " & gridControl1(5, 5).CellValue.ToString())

Sample:
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/F90247a.zip

Regards,
Rajadurai


AL Allon September 24, 2009 07:40 AM UTC

Rajadurai, It works perfect now.

Thanks for the help and explanations.

Have a nice day :)
Allon


RC Rajadurai C Syncfusion Team September 24, 2009 09:45 AM UTC

Hi Allon,

Thanks for your update.

Thankyou for using Syncfusion Products.

Regards,
Rajadurai

Loader.
Live Chat Icon For mobile
Up arrow icon