Solved

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

Posted on 1998-12-31
1
185 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

624 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