Datagrid problem

B

BK

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
 
B

BK

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.
 
B

BK

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.
 
C

Cor Ligthert [MVP]

BK
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.

This was what you wrote first about the same sample given by Ken.
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.

Nothing about what you wrote as answer now, why did you not write that
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
 
B

BK

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
 
H

Homer J Simpson

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.

You might want to reconsider your design in that case.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top