Solved

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

Posted on 1998-12-31
1
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

740 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