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.
Unfortunately, activation email could not send to your email. Please try again.

Deletion of one cell

Thread ID:

Created:

Updated:

Platform:

Replies:

27769 Apr 18,2005 01:24 PM Apr 19,2005 12:18 PM Windows Forms 14
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On April 18, 2005 01:24 PM

I have some questions about 3.2 In the sample I will email I keep getting a cast from string error in my currentcellvalidating event. in version 3110 of the grid i never got this error. if u run my sample and click cell 1,2 and hit ur delete key then try to move off with the arrow key u will get the message. It blows up on the following line of code Dim i As Single = CSng(Me.grdSC_GSC.CurrentCell.Renderer.ControlText) Control text in 3.2 is equal "" but in 3110 its equal to "0.00" Now we got that line of code from you guys wayyyyyyyyyy back last year. What changed??? Secondly. If on the grid on the bottom you hit the delete key on cell 1,1 and move off with the arrow key it doesnt give you that error because it doesnt have a currentcellvalidating event. The problem now is that in 3110 and all other version it would of put a ZERO(0) in the field right when you hit delete. Now it clears out the field in 3.2 Thanks Phil

Administrator [Syncfusion]
Replied On April 18, 2005 01:48 PM

In both cases, you have designer code setting an empty null string for those columns: StyleInfo.CurrencyEdit.NullString = "" If you change it to "0.00" then both behaviors go away, and you see zeros like you described. Did I miss something?

Administrator [Syncfusion]
Replied On April 18, 2005 02:24 PM

Yeah I dont think i described it well enough. The lower right grid in 3110 if you hit the delete key on a cell it would immediatly default the vaule back to zero. I never understood where the data came from either. If i do multiple cells then it would go to my clearingcells routine and put the zero in the cell. now in the lower right grid when you hit delete on a ONE cell it will blank it out instead of showing you the zeros. we dont want that we want it showing the zero value. then if you had a currentcellvalidating event(which i dont in the sample i sent) then it will blow up with that cast erro. so what has changed from 3110 to 3.2 on a one cell deletion. how is it getting that value and from where because it doesnt go to the clearingcells. i didnt put in a clearingcells event in the sample i sent you. The upper left grid I left something out of and need to figure out how to make you have it happen on your end. so you can ignore that question. its just the above question i need help with.

Administrator [Syncfusion]
Replied On April 18, 2005 02:40 PM

>>now in the lower right grid when you hit delete on a ONE cell it will blank it out instead of showing you the zeros. In the bottom, if I set nullstring = "0.00", and if I click on 1 cell with 100 in it and press delete, I am seeing 0.00 in the cell. When I leave it, it changes to 0. What is the behavior that you want?

Administrator [Syncfusion]
Replied On April 18, 2005 02:45 PM

thats exactly the behavior we want. but in the past in 3110 and since like early version 2 we had nothing but problems with the nullstring value under the currency property. eventually jay had us switch it all and not use that anymore. if setting nullstring to 0.00 fixes it then something has changed on your end because that wasnt the case in 3110

Administrator [Syncfusion]
Replied On April 18, 2005 02:46 PM

sorry i left off we want it to show whatever the default is for that form. in the lower grid the default value should be 0 when they hit delete. it did that for us somehow in the 3110 and now it doesnt?

Administrator [Syncfusion]
Replied On April 18, 2005 03:19 PM

You should set the nullstring to be the value that you want to see when you delete the entry of a currency cell.

Administrator [Syncfusion]
Replied On April 18, 2005 03:22 PM

Clay, I get that but like i said jay had us change how we did all that for other reason way back. Can you see how this does work in 3110 but doesnt work now in 3.2? Im just tryin to figure out what has changed. I know that will fix it what you said but its been working like i described for a year now without doing that. Phil

Philip Bishop
Replied On April 18, 2005 03:51 PM

Ok after reading back through my direct trac 9914 I found a couple of things that were causing us problems. Because of some data bound vs non data bound grids you guys made some changes that back in 2.0 something causes similar things that are happening now. We were told to use the clearing cells because i found that if you COPY a zero from one cell to another in the grid well then its puts a null value in the cellvalue instead of a zero. There were many reasons in that direct trac why he steered us towards clearning cells when we wanted the nullstring to work how it was working and how we thought it should work. Setting nullstring was the easy way to go and he was only making more work for us and nullstring was fine until one of the 2.0 releases. Now its like you are telling me to go back. Im just really confused and thats why i want to know why it was working in 3110 and now its not. Something changed

Administrator [Syncfusion]
Replied On April 18, 2005 05:11 PM

It was our intent to fix the problem you reported with the NullString not appearing when you press the delete key. Here are the change history notes on the GridCurrencyTextBoxCell.cs file: 3/8/05 - Fixed currency cell issue that null string was not displayed when user pressed delete key. 2/12/05 - Added ShouldDeleteKeyClearCurrentCellContentsOnly Fixed Home, End and Delete Key behavoir when pressed in non-edit mode. 2/11/05 - Fixed DeleteKey behavior when multiple cells were selected.

Administrator [Syncfusion]
Replied On April 18, 2005 09:35 PM

Ok so im confused now. Is it working or not working? You lost me with it was ur intent to fix it. DOes that mean it wasnt fixed? We just want the easiest way to do this and it always seemed from day one that the nullstring was the way to go. That was until that direct trac reference i posted above. Then it was like well it doesnt really seem like its working right and now we have to add this clearingcells event to all the forms. So im more confused now then ever on this. Still i dont know how one cell in 3110 and before and up until 3.2 how a single cell was getting 0 or 0.00 whatever the case was in it when i didnt use a null string and when a single cell doesnt go to the clearing cells event.

Administrator [Syncfusion]
Replied On April 19, 2005 04:58 AM

It is fixed in your sample. If you set NullString, then pressing Delete on either one currency cell or a range of currency cells will display the NullString setting whether or not you use your ClearingCells code. The nullstring was not working with the delete key in earlier versions. That was a bug. Until it was fixed, we tried to suggest that you use a workaround of some type until it got fixed. It is now fixed.

Administrator [Syncfusion]
Replied On April 19, 2005 08:56 AM

Ok a couple of questions. What happens if you have a clearing cells and a nullstring value set? Does it try to do both? Is only one done? The reason I ask is because this nullstring still doesnt seem to work right all the time just as i said back in that direct trac. If you run my sample and in the lower grid set the nullstring to 0. Run it and copy the zero in cell 1,2 with ctrl c and paste it with ctrl v in cell 1,1. Puts the zero in the cell and everything looks great. Now click the button and then do a watch on grdGrossOrder(1,1). Look at the cell value it has "" in it. The formatted text has the zero but the cell value that we have all over our forms has a null value in it. Now copy the 100 in cell 2,1 and paste it in cell 2,2. Now click the button and do a watch on grdGrossOrder(2,2). Look at the cell value and it has 100 in it. So why if i copy 100 does it show 100 but if i copy zero do i get ""?

Administrator [Syncfusion]
Replied On April 19, 2005 10:41 AM

The NullString is strictly for display. It is what is shown in the cell when the cell is empty. When you copy the cell, the NullString is not copied as it is the cell value (the empty string) that is copied. So, if you never want to have an empty cellvalue, that is different than displaying something when you have an empty cell. For example, you might want the NullString to be "-" so that you see a hyphen in empty cells. This does not mean that a hyphen should be stored as the cellvalue as the cellvalue should be something that makes sense as your CellValueType. So, setting a NullString does not set the value in cell, and so the nullstring will not get copied. If you want this behavior (actually replacing the cellvalue of empty cells so the cellvalue is zero), then you will have to do more work than just setting the NullString. You could use your current CurrentCellValidating code, and conditionally call CSng depending upon whether Renderer.ControlText was "" or not. If it is "", just directly set the zero value instead of calling CSng. This will avoid the original exception you had.

Administrator [Syncfusion]
Replied On April 19, 2005 12:18 PM

Ok so i see its just going to require some work to change all of our forms to use the nullstring now for how it works now in 3.2. Thanks

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;