|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Datagrid problema SQL table. Only some of the columns are editable. When the user changes data in 2 and only 2 of the columns, I want to perform some calculations. There are about a dozen fields, only 3 of them are editable and I only want to perform the calculations when the user has changed the data in either of 2 columns. I have posed this before without any suggestions that workd. The Datagrids CurrentCellChanged method works great IF I wanted to always perform the calculations. However, as I stated above I DON'T want to do that. CurrentCellChanged fires everytime the user moves around in the Datagrid. Ok, so in the Datagrid CurrentCellChanged method I inserted some code like this: Me.DsEventLineItemsView.HasChanges(DataRowState.Modified) The problem I encounter with this code is that it only returns a True IF the user has moved OFF the row. I MUST perform the calculation when the user changes the value in either of the 2 columns REGARDLESS of whether they move to another row. I also tried: Me.DsEventLineItemsView.Tables(0).AcceptChanges() before testing to see if the dataset.HasChanges returns True (that was suggested to me). That didn't change anything. The calculations take a lot of work to perform, it kills performance if I have to do them after every cell change. Any help is appreciated. Bill Hi,
I would add a calculated column to the datatable. That way you would not have to worry about doing the calculation yourself. http://www.vb-tips.com/default.aspx?ID=30d9d2fd-9f10-4928-b7c8-1def3152436f Ken ------------------------ Show quoteHide quote "BK" <bkunn***@hotmail.com> wrote in message news:1143584613.599774.17630@v46g2000cwv.googlegroups.com... > In VB.Net (1.1 framework), I have a datagrid that displays records from > a SQL table. Only some of the columns are editable. When the user > changes data in 2 and only 2 of the columns, I want to perform some > calculations. There are about a dozen fields, only 3 of them are > editable and I only want to perform the calculations when the user has > changed the data in either of 2 columns. > > I have posed this before without any suggestions that workd. The > Datagrids CurrentCellChanged method works great IF I wanted to always > perform the calculations. However, as I stated above I DON'T want to > do that. CurrentCellChanged fires everytime the user moves around in > the Datagrid. > > Ok, so in the Datagrid CurrentCellChanged method I inserted some code > like this: > > Me.DsEventLineItemsView.HasChanges(DataRowState.Modified) > > The problem I encounter with this code is that it only returns a True > IF the user has moved OFF the row. I MUST perform the calculation when > the user changes the value in either of the 2 columns REGARDLESS of > whether they move to another row. > > I also tried: > > Me.DsEventLineItemsView.Tables(0).AcceptChanges() > > before testing to see if the dataset.HasChanges returns True (that was > suggested to me). That didn't change anything. > > The calculations take a lot of work to perform, it kills performance if > I have to do them after every cell change. Any help is appreciated. > > Bill > Except that doesn't address the problem. The users want to see the
results of the calculation immediately. For example: User selects a line in the datagrid User changes the quantity column No matter what they do next (tob over to the next or previous column, mouse click to another column, move to another row, etc.) they want to see the new calculated total. It works fine IF they move to another row, in that case the dataset HasChanges returns a true. When the move to another column for that row, then it doesn't trigger. I can't believe there isn't something that will tell me if the user changed a particular row without moving off that row or worse, fetching that row again and comparing it to the values in the datagrid. In Visual FoxPro (where I spent many years developing), this was such a simple task. I love .NET now, but I find it difficult to believe that VFP has had this capability for 10 years and VB.NET doesn't. BK,
Did you test it? Cor Show quoteHide quote "BK" <bkunn***@hotmail.com> schreef in bericht news:1143636705.075490.147890@i40g2000cwc.googlegroups.com... > Except that doesn't address the problem. The users want to see the > results of the calculation immediately. > > For example: > > User selects a line in the datagrid > User changes the quantity column > No matter what they do next (tob over to the next or previous column, > mouse click to another column, move to another row, etc.) they want to > see the new calculated total. > > It works fine IF they move to another row, in that case the dataset > HasChanges returns a true. When the move to another column for that > row, then it doesn't trigger. > > I can't believe there isn't something that will tell me if the user > changed a particular row without moving off that row or worse, fetching > that row again and comparing it to the values in the datagrid. > > In Visual FoxPro (where I spent many years developing), this was such a > simple task. I love .NET now, but I find it difficult to believe that > VFP has had this capability for 10 years and VB.NET doesn't. > Yes I did. The problem is that I only want to perform the calculations
when a cell is changed. That example is a fine one and I'll store it for future use, but it causes the recalculation to run every time the user moves around, not just when a cell is changed. The calculations involved are much more complex than multiplying 2 columns and therefore take time to perform. If I fire the recalculation every time the user moves around, performance is unacceptable. BK
> Yes I did. The problem is that I only want to perform the calculations This was what you wrote first about the same sample given by Ken.> when a cell is changed. That example is a fine one and I'll store it > for future use, but it causes the recalculation to run every time the > user moves around, not just when a cell is changed. The calculations > involved are much more complex than multiplying 2 columns and therefore > take time to perform. If I fire the recalculation every time the user > moves around, performance is unacceptable. Show quoteHide quote > Except that doesn't address the problem. The users want to see the Nothing about what you wrote as answer now, why did you not write that > results of the calculation immediately. > > For example: > > User selects a line in the datagrid > User changes the quantity column > No matter what they do next (tob over to the next or previous column, > mouse click to another column, move to another row, etc.) they want to > see the new calculated total. > > It works fine IF they move to another row, in that case the dataset > HasChanges returns a true. When the move to another column for that > row, then it doesn't trigger. > > I can't believe there isn't something that will tell me if the user > changed a particular row without moving off that row or worse, fetching > that row again and comparing it to the values in the datagrid. > > In Visual FoxPro (where I spent many years developing), this was such a > simple task. I love .NET now, but I find it difficult to believe that > VFP has had this capability for 10 years and VB.NET doesn't. > direct as answer to Ken, than I had understand it, because what you write now is the problem with the sample. Who tries fooling here everybody in this newsgroup. I think that it cost in this way to much time to help you. Cor I'm sorry that the sample didn't work for me, but you don't have to
accuse me of wasting anyone's time. If you don't have anything productive to add, please just disregard the post. I'm not trying to waste your time or anyone else's time. This is a forum, read and respond as you wish and disregard what you wish. I'd like to think we are all professionals here. BIll "BK" <bkunn***@hotmail.com> wrote in message You might want to reconsider your design in that case.news:1143647850.596307.250030@e56g2000cwe.googlegroups.com... > Yes I did. The problem is that I only want to perform the calculations > when a cell is changed. That example is a fine one and I'll store it > for future use, but it causes the recalculation to run every time the > user moves around, not just when a cell is changed. The calculations > involved are much more complex than multiplying 2 columns and therefore > take time to perform. If I fire the recalculation every time the user > moves around, performance is unacceptable.
Class question
Form Exit Doing some extra task while saving databind Controls in VB.Net 2005 ? Dynamically Loading Programs Oledb VS Sql. Oledb works with Sql Server; Sql doesn't...why select all text when textbox1 is clicked Auto-stop DUN via VB.Net? Adding HTML code to project. SQL Server and ADO.Net best method Re: ContextSwitchDeadlock was detected |
|||||||||||||||||||||||