Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 1998-12-31
1
Medium Priority
?
186 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 200 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

704 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