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

problem with my clearingcells event

I have this problem with a grid that I cant seem to figure out. If you run this sample that i have attached and type in a numeric value in cell 1,1. Then hit the OK button and u will get an error message that is specific to our app. After u get the error click ur mouse in cell 1,1 and try to hit the delete key which is suppose to put a zero in the field from the clearning cells event. It doesnt work. If u come in to this app fresh and hit delete on the cell it puts the zero there fine. If after the error message u move off the cell by either clicking another cell or arrowing to another cell and then back to 1,1 and then hit the delete key it works fine. Its only right after the error message that this happens. It doesn this on any cell in that column. Am i missing something? I''ve tried everything I can come up. Thanks in advance. clearingcellPROB_8068.zip

5 Replies

AD Administrator Syncfusion Team September 13, 2004 02:42 PM UTC

I can get you sample to work by adding this code at the bottom of your button click handler. > Me.grdAGCY_AR.Focus() Me.grdAGCY_AR.CurrentCell.MoveTo(-1, -1) Clicking the button gives the focus to the button, and when the messagebox closes, it is teh button that retains focus and not the grid. So, calling grid.Focus gives the focus back to teh grid. The other call is to force the cell to refresh itself.


PB Philip Bishop September 13, 2004 03:09 PM UTC

Ok so i dont get what the problem is with it. Why after the error can i click on the cell under the errant cell and hit delete. Whats the diff between clicking that cell or the one that had the error. Seems to me as if i''d be doing the same thing???


AD Administrator Syncfusion Team September 13, 2004 04:14 PM UTC

Did adding the two lines work around the problem for you? What I think is happening is the the Currency control is not being reinitialize on the click since it is already located at the cell being clicked. This is causing the code in your clearing cells which changes the data using indexer''s on the grid not to affect the value in the actively editing (from the click) cell. Using the 2 suggested lines seems to avoid this problem. I will discuss this with Stefan to see if this is something that we can address in our library but I am not sure how much work this might be.


PB Philip Bishop September 14, 2004 10:23 AM UTC

Yes that did solve the problem. I just didnt understand what it was doing and why it was happening. What does setting that to -1 -1 do? Why doesnt that move the cursor from the current cell to -1 -1???


AD Administrator Syncfusion Team September 14, 2004 10:31 AM UTC

Using the -1, -1 makes the grid not have a current cell. Thus, when the current cell is then later reset with the click on 1,1, the CurrencyEdit control does not think it is already active, and reinitializes itself.

Loader.
Live Chat Icon For mobile
Up arrow icon