ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 26th, 2003, 11:18 PM
lrdnight lrdnight is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 2 lrdnight User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy adding Numbers in text boxes....Please Help


OK Needs ome help here, I have been tryign and trying and trying. and Can not get it.
I have 7 text boxes and 1 total box
(see attachment (course I have stripped alot of my code out of it))

txtscore1
txtscore2
txtscore3
txtscore4
txtscore5
txtscore6
txtscore7

txttotal

Heres what I am trying to do. if I put 100 in txtscore1 and 200 in txtscore2 I want them to add together in txttotal showing 300, then if i put 100 in txtscore3 it adds that to what ever is in txttotal already showing 400, basically to keep a running total.

Thank You for your Help

Lord_Night
Attached Files
File Type: zip scorer.zip (1.9 KB, 461 views)

Reply With Quote
  #2  
Old October 27th, 2003, 12:29 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 8
Your problem is quite simple.
You had the right idea in creating a control array from your textboxes, however, you did not execute it correctly.

The first column of textboxes you have named txtScore1, txtScore2, etc.

The problem here is that each of these you have set as a different control array.

What I did was I named all the textboxes in the first column of to txtScore1. This creates a control array ( first txtScore1 has an array index of 0, the next gets 1, and so on ).

I did the same for the second column, however, I named those txtScore2 respectively.

This makes your code a lot more manageable. Now I wrote the code to loop and calculate the values on the fly. Here is the code in full... much shorter than what you had.

This code is everything in FrmScorer :

Code:
Option Explicit

Private Sub txtTotal_calculation()
Dim total As Double
Dim i As Integer
total = 0

For i = 0 To txtScore1.UBound Step 1
    total = total + Val(txtScore1(i).Text)
Next i

txtTotal1.Text = total

End Sub

Private Sub txtScore1_Change(Index As Integer)
    Call txtTotal_calculation
End Sub


BTW, I deleted your about form event as you did not include the frmAbout form.
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old October 27th, 2003, 01:38 AM
lrdnight lrdnight is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 2 lrdnight User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking Thanks For the help

Thank You So much laidbak, I overlooked a few things,

worked great even got the second row adding.

Thanks Again for showing the easy one.......

Lord_Night

Reply With Quote
  #4  
Old October 27th, 2003, 02:03 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 8
No problem. We all have times when we overlook the most (seemingly) obvious items.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > adding Numbers in text boxes....Please Help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 8 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek