Solved

Visual C++ 6.0

Posted on 2003-11-11
4
240 Views
Last Modified: 2010-04-02
Hey
I've just been checking out Visual C++ 6.0, and was wondering how can i add,subtract etc, numbers which are inputed into edit boxes,
e.g. i have 4 edit boxes, box1=number1,box2=number2, box3=add,subtract..etc, and box 4 is the sum of number1&number2.
So when the user has inputed the values, he can then click a button which will calculate the value and display it in editbox 4.
how could i go about doing this?
0
Comment
Question by:cpu4ghz
4 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 50 total points
ID: 9721379
Well, the process is simple:

1) You get the user input from these edit boxes and validate the data.
2) You then convert that text input into a suitable number.
3) You perform your mathematical operations on those numbers.
4) You then display the results.


BTW: This is not really a C++ language question and is off-topic here.
0
 
LVL 13

Expert Comment

by:SteH
ID: 9721384
simple approach:
Assign numeric variables to the editboxes 1,2 and 4 (long, double) with the ClassWizard (Ctrl+W) and a string var to editbox 3.

After calling
UpdateData (TRUE)
you can use
your variables. Depending on the value of var3 you add, subtract etc var1 and var2 and store the result in var4
A call to
UpdateData (FALSE) puts the result of var4 into editbox.
0
 
LVL 9

Expert Comment

by:tinchos
ID: 10248932
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: jhance {http:#9721379}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now