Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 6th, 2004, 09:56 AM
Authorized User
 
Join Date: Jan 2004
Location: Blair, , United Kingdom.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding Values

Hi Im trying to add values in VB, the program calculates 4 different values within separate text boxes, there is then a final "total" text box, however when I try to add these to get a total, it just lists the 4 totals one after the other. Just cannot get it to calculate a total!
Help Please!
Cheers
Neil

Reply With Quote
  #2 (permalink)  
Old February 6th, 2004, 10:45 AM
Authorized User
 
Join Date: Feb 2004
Location: Leeds, West Yorkshire, United Kingdom.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

It sounds like you're just adding the string values in the text fields together, you'll need to create a function in a module ( or wherever) to turn these into integer / double values and then return the answer.
This code worked for me

Private Sub Command2_Click()
Dim int1 As Integer
Dim int2 As Integer
Dim int3 As Integer

int1 = Text1.Text
int2 = Text2.Text
int3 = Text3.Text

Label1.Caption = int1 + int2 + int3

you'll need to do some validation in the text boxes but that's easy enough!

Simon



Don't think, do!
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding up values in xslt northwind XSLT 21 February 17th, 2017 09:07 AM
adding values between datasets Ashubhatt BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 0 June 19th, 2008 04:37 AM
Adding the values within an array Dave_Richards Beginning PHP 0 November 8th, 2006 04:34 PM
Adding 2 values in a table Regornil JSP Basics 2 September 13th, 2004 02:32 AM



All times are GMT -4. The time now is 07:37 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.