473,473 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Simple Windows application

Hi All,

I just start using MS Visual C++ 6.0 and I try to make a very simple
application
I created a dialog application and I added two controls (Edit boxes).
Using ClassWizard I added a CString member variable to each edit box.
Now, I want to create the code that when I press on a button, I should read
the number I type in the first Edit Box (an integer) and to display the
double of that number in Edit Box no 2.
I am not sure if I should create String variables for each Edit Box or an
Integer variable.

Any help appreciated

Regards,
Nicolae
Jul 22 '05 #1
2 1665
Nicolae Fieraru wrote:
I just start using MS Visual C++ 6.0 and I try to make a very simple
application
I created a dialog application and I added two controls (Edit boxes).
Using ClassWizard I added a CString member variable to each edit box.
Now, I want to create the code that when I press on a button, I should read
the number I type in the first Edit Box (an integer) and to display the
double of that number in Edit Box no 2.
I am not sure if I should create String variables for each Edit Box or an
Integer variable.


Are you sure you need the CString member variable for each edit box?
It's much easier if you do integer member variables instead, like this:

void CMyDialogBox::OnButton1()
{
UpdateData(true);
m_int2 = 2 * m_int1;
UpdateData(false);
}

Otherwise you would have to convert between string an integer yourself.
For instance:

#include <boost/lexical_cast.hpp> // From www.boost.org

void CMyDialogBox::OnButton1()
{
try
{
UpdateData(true);
const TCHAR *const psz = m_string1;
const int i = 2 * boost::lexical_cast<int>(psz);
m_string2.Format(_T("%d"), i);
UpdateData(false);
}
catch(...)
{
// TODO Exception handling...
}
}

If you wanna know more about converting strings to integers, this is the
right newsgroup for you! But if you have more questions on MFC,
ClassWizard, CString, UpdateData, and edit boxes, you'd better try
another newsgroup, for instance: microsoft.public.vc.mfc

Niels Dekker
www.xs4all.nl/~nd/dekkerware
Jul 22 '05 #2
Hi Niels,

Thank you very much for your answer, it is helpful. I will use integer
variables for this project.
I was also looking for the proper NG, but I couldn't find it before. I will
post my future questions related to Visual C++ on microsoft.public.vc.mfc

Best regards,
Nicolae

Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: learningGuy | last post by:
Can someone tell me what is wrong with this simple code? I get an exception every time at the myFile.Open() line. I have included the code that I think is needed to for you to answer this below:...
0
by: Tal Sharfi | last post by:
Hi everyone I recently had the need for StringGrid object same as the one that Delphi has. An object that helps show lists of other objects in a simple grid. I searched the news groups and...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
by: Ryan McBride | last post by:
Once again at my wonderful job i've been given the task of "come teach your fellow idiot coworkers the skills you have" I write software for a company in chicago. I use visual basic on asp.net...
3
by: ben | last post by:
All, What I have: I have written a VB.net application that uses Access DBs and Make 100s of Excel documents from the data. What I need: I need a Simple ASP.NET Page that will basically pass...
2
by: Abel Chan | last post by:
Hi there, I just got an assignment to work on server maintenance. It is a weekly task and we have about 7 production servers running Win2K server. The tasks include but not limited to 1)...
4
by: bob lambert | last post by:
Help I am trying to deploy to another pc a vb.net std 2002 windows form application. I am confused. I created a project - windows form I built form, compiled and debugged. I created a...
9
by: Andrew | last post by:
Hi, I implemented a simple WMI Provider in C#. It is a service which expose 10 instances of a simple WMI Class. The WMI class pnly expose 4 public properties (Value,Min,Max,StdValue) which...
4
by: Tony M | last post by:
VS 2005 - XP media - VB .net - winforms - .net 2.0 Just trying to send an email, here is the code and the error message that I get. I can't figure out how to fix it?
0
by: Hugh Janus | last post by:
This is driving me crazy! It should be so simple! Can anyone tell me what is going wrong? All I am doing is adding a single button to a form but it fails :-( I am using VB.NET 2005 to create...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.