473,802 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ 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 1342
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.rowcon taining = 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
4290
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 procedure off of. I access them right now using the item.cell().control method. Here's the code:
4
1496
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
2001
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 populated by sqlserver database table.When i select value from combobox ,value saved in to other table of my database and i use to datagrid to show this table.
2
2013
by: Balamurukan | last post by:
How to retrive property values from our own property window
3
4936
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 is being sent to the database is correct and the changes are eventually being made. If I refresh the page after the update then the new values appear. I noticed that when I put a breakpoint in my update handler everything works fine. When I take...
0
1062
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 call the LoadDataRow method to update the DataTable "in place". I've been using boundcolumns for the invisible fields, which worked fine, but now I've run into an issue with them. On the second of the 3 pages, the user can modify certain...
4
2586
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 datagrid. Currently I use a join between the main table and the lookup table to get the Product description. Is it possible to use a dropdownlist in the datagrid to display and select (in Edit mode) the lookup values? Thank you.
1
1395
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 a database (by clicking on a submit button). The problem is that every time, the "add row" or "delete row" button is clicked, the textbox values in the datagird are emptied, because when the page postbacks it gets the latest datatable from a...
5
1388
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 problem, however, since I need to do a bunch of calculations with these values AND pull values for two session variable within the web application, I need to create another datagrid to display the calculations. Here is what I'm doing: ...
4
1360
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 like to take the values and enter them into a String Variable, but can't find a good way to do this with more than 1 value.. Help!! Thanks, Shawn
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9559
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10301
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10280
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10058
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6835
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5492
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4268
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2964
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.