473,472 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Add the values in datagrid

46 New Member
Hi all,

Can anyone help me?? I want to add all the values in the datagrid in a field to a text box. How do I do? The below is my code. But it only can display the first value. It cannot add all the values. Please have a look on it. Thank you very much...

Expand|Select|Wrap|Line Numbers
  1. Dim total As Single
  2. total = 0
  3.      Do While Not Adodc.Recordset.EOF
  4.         total = total + Adodc.Recordset.Fields("Hour")
  5.         text1.Text = total
  6.         Adodc.Recordset.MovePrevious
  7.      Loop
May 29 '07 #1
5 1331
Killer42
8,435 Recognized Expert Expert
Perhaps you need to to a MoveLast before starting this?
May 29 '07 #2
berry
46 New Member
YEA..It's work!! Thank you very much..
May 29 '07 #3
Killer42
8,435 Recognized Expert Expert
YEA..It's work!! Thank you very much..
Excellent! Glad to help. :)
May 29 '07 #4
Killer42
8,435 Recognized Expert Expert
Hi killer42,
now I having another problem. I want to consider that if there is no data in the datagrid, what is the code I should use?

I try to use datagrid.rowcontaining = 0 but it is wrong. I really don't know what should use. Hope to help.

Thank you.
Sorry, I'm really not familiar with the datagrid. I suggest you post this as a new discussion thred so others can answer it.

Hold on - I'll split it off to its own thread for you. Here's a link to the new thread.
May 29 '07 #5
berry
46 New Member
ok. thank you very much..

Sorry, I'm really not familiar with the datagrid. I suggest you post this as a new discussion thred so others can answer it.

Hold on - I'll split it off to its own thread for you. Here's a link to the new thread.
May 29 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Derek | last post by:
Another DGrid question... I can not access the values of a cell in a datagrid unless I make them visible. I do not want these fields displayed. I only want to use the values to run a stored...
4
by: Job Lot | last post by:
On form load my datagrid gets populated with values from database table. How can I reset values in my DataGrid to 0 on click of a button? thanks
0
by: Gamze | last post by:
Hi, How can i get values from datagrid to combobox and should select the same name as in datagrid row on the combobox control In my vb.net windows application ,i have combobox which is...
2
by: Balamurukan | last post by:
How to retrive property values from our own property window
3
by: Kevin Pedersen | last post by:
Hello, I am using an editable datagrid. After I save the changes the datagrid shows the old values. I've read the posts about the Page_Load and not binding the datagrid each time. The SQL that...
0
by: Mike | last post by:
I've got an app with a DataTable that gets passed around and modified by datagrids on 3 different asp.net pages. Not all columns need to be displayed, but I need them all in the datagrid so I can...
4
by: Vik | last post by:
How can I display the lookup values in a datagrid? E.g., the datagrid displays a table that contains a ProductID field. I want to display a Product description from a Product table in that...
1
by: Arjen Hoekstra | last post by:
Hello, I've got a datagrid with a textbox in each cell. I've also two buttons, one to add a row to the datagrid and one to delete a row. A user can type data into textboxes and then submit it to...
5
by: Coleen | last post by:
Hi all :-) We are using a DB2 database connection through a class module to get the data into a datagrid in an aspx web page using VB.Net. I can get the data into the first datagrid with no...
4
by: Shawn | last post by:
This must be easy, but I can't find a way to do it. I have a datagrid displaying Rows from a Datatable. I want to take the values in the Row and ultimately use them in a SQL Where string. I would...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.