If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > datagrid value

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-06-11, 23:37
krishnanhemanth krishnanhemanth is offline
Registered User
 
Join Date: May 2009
Posts: 23
datagrid value

hi everybody

i have form which holds a datagrid "DELIVERY_CHALLAN_SUB_QRYDataGridView"

i have a filed/textbox "qty" in data grid which is populated by the user

the field/textbox "qty" is in column 3

i want the sum of all the rows of the column "qty" to be displayed on the form in a text box

please help me

hemanth
Reply With Quote
  #2 (permalink)  
Old 07-18-11, 06:11
Sam76 Sam76 is offline
Registered User
 
Join Date: Jun 2005
Posts: 61
Hi krishnanhemanth .. Form Me I Can Solve It in 2 ways ...
1. Connect to database and Select Sum(qty) and display it
2. with For loop ... Code:
Dim Sum_Qty as double = 0
For i as integer = 0 to DELIVERY_CHALLAN_SUB_QRYDataGridView.ROWS.Count
If Sum_Qty=0 then
'This to Get First QTY
Sum_Qty= DELIVERY_CHALLAN_SUB_QRYDataGridView.rows(i).Cells (3).value
else
Sum_Qty=(Sum_Qty + DELIVERY_CHALLAN_SUB_QRYDataGridView.rows(i).Cells (3).value)
End If
Next
Textbox1.tex = sum_Qty

I Hope this Will Help You ...
Good Luck
__________________
Sami Al Damiri ...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On