Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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 how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

760 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

21 Experts available now in Live!

Get 1:1 Help Now