Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ColumnChanged-ColumnChanging
Message
De
18/11/2004 11:21:04
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
ColumnChanged-ColumnChanging
Versions des environnements
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
00962666
Message ID:
00962666
Vues:
43
I have a datagrid bounded to a datatable in which i process orderdetails, i want to calculate each time i change price or quantity the total column value, that works with the following code only when i press the keydown key and inserts a new line behaviour that i want to avoid, i want to change the total column value and the total orders amount each time i change quantity or price value remaining in the same row
Another problem i 'm having is that it does not recalculate the total order's amount as i intend in the total () method after changing the columns value.

Private Sub Column_Changed(ByVal sender As Object, ByVal e As DataColumnChangeEventArgs)
If e.Column.ColumnName = "precio" Or _
e.Column.ColumnName = "cantidad" Then
Dim stot As Decimal
stot = Convert.ToDecimal(e.Row("precio")) * _
Convert.ToDecimal(e.Row("cantidad"))
e.Row("Total") = stot
e.Row.EndEdit()
End If
Me.total()
End Sub

Sub total()
Dim decTotal As Decimal
decTotal = Convert.ToDecimal(ds.Tables("movdet").Compute("sum(Total)", "cantidad<>0"))
Me.TxtTotal.Text = Format(decTotal, "#,###,##0.00")
End Sub
Thank's in advance for your help.
Répondre
Fil
Voir

Click here to load this message in the networking platform