Solved

Very simple VC++ 6.0 problems... I'm a novice

Posted on 1998-12-31
1
180 Views
Last Modified: 2010-04-02
I just now started using Visual C++. I know a lot about C++ but not visual. I have one easy question: If I have an Edit Box control and a button, how would I:
a. Read the input in the edit box
b. Check the validity of the input (make sure it is an integer)
c. Spit out the input in a dialog box when the button is clicked?

Thank you all,
Dan
0
Comment
Question by:SuperMario
1 Comment
 
LVL 4

Accepted Solution

by:
pagladasu earned 50 total points
ID: 1181370
Use resource editor to create the edit control in a dialog box.
Select the control. Go to its Properties - Style - and set the Number checkbox.
This will allow only numeric input.
To read the input, declare a CString variable say called m_str.
Assume that the edit control has an id called IDC_EDIT1.
Use
GetDlgItem(IDC_EDIT1)->GetWindowText(m_str);
m_str will now contain the edit controls input.
Use classwizard to map the BN_CLICKED event of the required command. In that handler,
write:
MessageBox(m_str);

thanks
pagladasu


0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

777 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