AllExperts > Experts 
Search      

VB.NET

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More VB.NET Answers
Question Library

Ask a question about VB.NET
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Syed Rizwan Muhammad Rizvi
Expertise
I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.

Experience
Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.

 
   

You are here:  Experts > Computing/Technology > Basic > VB.NET > Working with Datagridview

Topic: VB.NET



Expert: Syed Rizwan Muhammad Rizvi
Date: 8/11/2008
Subject: Working with Datagridview

Question
QUESTION: Dear Sir, I am the learner of .net. I have a Datagridview which consist of columns ie, Quantity, Unit_Price & Total_amount. When I enter the
the values in Quantity & Unit_Price the Total_Amount Colums calculates the total amount ie, Quantity*Unit_Price,
but how to calculate the sum of Total_Amount column.
Pls can u help me in this matter.
With Regards
Satish M.B




ANSWER: in SQL, you write: Select Sum(Total_Amount) from tblOrderDetails Where OrderID = @OrderID

---------- FOLLOW-UP ----------

QUESTION: Dear Sir, thanks for ur suggestion. But what the thing i need is, I have a Datagridview & a blank dataset with 3 cloumns of Quantity,Unit Price & Total Amount. In expression property of Total Amount I have mentioned as Quantity*Unit_Price, I have bind that blank dataset to Datagridview. I enters the values manually in Quantity & Unit_Price cell & when I moves to next row Total_amount cell will calculate by itself with the help of expression property. I have a text box which will shows the sum of Total_amount column. As & when the cursor moves to next row the sum has to be calculate by itself & shown in text_box. Pls can u help me in this matter.
With Regards
Satish M.B

ANSWER: Post this into asp.net/javascript section as you would require some javascript bound to your textboxes to trap the onfocus/onblur events to do the perform the calculations.


Regards,
Rizwan

---------- FOLLOW-UP ----------

QUESTION: Dear Sir, Pls Sir can U explain me how to calculate the sum of Total_amount column of DataGridView.

With Regards.
Satish M.B


Answer
dim tmpTotalAmount as double = 0
For each tmpRow as GridViewRow in GridView1.Rows
tmpTotalAmount += tmprow.cells(5).text 'Cell number 5 refers to the column that contains the TotalSum of each row.
Next

'Here you will have the sum of whole order.
msgbox tmpTotalAmount

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.