473,378 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Total amount in Data grid Columns

Hi!
I have little trouble in my Program. I need to total all the amount in specific column.. comes from the data produced by the datagrid..

heres my code:

Set rs11 = New Recordset
rs11.CursorLocation = adUseClient
rs11.Open "Select * From Leave WHERE EmpNo= '" & Txtempno.Text & "'", con, adOpenDynamic, adLockOptimistic
Set DataGrid1.DataSource = rs11

Dim i
Dim Total As Double

For i = 0 To DataGrid1.ApproxCount - 1
Total =Total + DataGrid1.Columns(15).CellValue(DataGrid1.GetBookm ark(i))
Next
TXtTotal.Text =Total

my problem is the total amount. example:

Column1

525.25
625.50

Total: 1150.75(which is correct) but it only display like this

Total : 1150 (without a decimal places)

How I can fix this??? Please help me.. tnx..
Mar 12 '08 #1
2 7449
jeffstl
432 Expert 256MB
Hi!
I have little trouble in my Program. I need to total all the amount in specific column.. comes from the data produced by the datagrid..

heres my code:

Set rs11 = New Recordset
rs11.CursorLocation = adUseClient
rs11.Open "Select * From Leave WHERE EmpNo= '" & Txtempno.Text & "'", con, adOpenDynamic, adLockOptimistic
Set DataGrid1.DataSource = rs11

Dim i
Dim Total As Double

For i = 0 To DataGrid1.ApproxCount - 1
Total =Total + DataGrid1.Columns(15).CellValue(DataGrid1.GetBookm ark(i))
Next
TXtTotal.Text =Total

my problem is the total amount. example:

Column1

525.25
625.50

Total: 1150.75(which is correct) but it only display like this

Total : 1150 (without a decimal places)

How I can fix this??? Please help me.. tnx..

Do you want the decimal points or you do NOT want them?

Here is a thread on rounding in VB

http://www.thescripts.com/forum/thread546299.html
Mar 12 '08 #2
Do you want the decimal points or you do NOT want them?

Here is a thread on rounding in VB

http://www.thescripts.com/forum/thread546299.html
I need a number with decimal places....
Mar 13 '08 #3

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

Similar topics

3
by: pmud | last post by:
Hi, I have 4 columns in my sql database table. I added a data adapter , data set & a data grid to view this information. But the data grid is displaying those 4 columns TWICE , i.e in the data...
2
by: Josef Meile | last post by:
Hi, I'm using a ComboBox, some Textboxes, and a DataGrid to represent a many-to-many relationship between Person and Course. Each time that I change the value in the ComboBox (which for now is...
6
by: Hutty | last post by:
I've looked around and have yet to find anything that would answer my question regarding formating a column in a datagrid. My grid looks like this as far as data" AMHQCON|51300.01|-3147 The...
3
by: pmud | last post by:
Hi, I have a web page (asp.net, code:c#). I havean html table with text boxes. Based on the user input , records are displayed in the data grid below it. Now the datagrid has a large no. of...
0
by: hlam | last post by:
Help - Calculating the total of a column in a data grid -- when data grid is part of Master-Detail set-up I have setup a Master-Detail form using Visual Studio.Net. A ListBox is the (Master)...
0
by: Gian Paolo | last post by:
this is something really i can't find a reason. I have a form with a tabcontrol with tree pages, in the second page there is a Data GRid View. Plus i have a class. When i open the form i...
9
by: trint | last post by:
How can I retrieve all of the data from a datagridview? Any help is appreciated. Thanks, Trint
3
by: tshad | last post by:
I am building a GridView that is displaying some money values in 3 columns. I want to put the totals of each column in a label field (one for each column) in the footer. I was trying to figure...
0
by: Taxman | last post by:
Windows XP, MS Office Excel 2003 If the tasks, I’m trying accomplish have been addressed previously (separately or in combination). Please, provide the links or keyword search to find them. I’ve...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.