|
-
Mar 24th, 2003, 10:27 PM
#1
Thread Starter
Stuck in the 80s
[Resolved] MFC: "Please enter a number?"
I'm working in an MFC application (my first time), and whenever I erase the contents of my EditBox, or enter a non-numeric character, I get a messagebox saying "Please enter a number."
How can I get rid of this?
Last edited by The Hobo; Mar 25th, 2003 at 04:21 PM.
-
Mar 25th, 2003, 12:08 AM
#2
Frenzied Member
r u using UpdateData(TRUE) instead of UpdateData(FALSE)
also check to make sure the variable u have linked to it is string or cstring
Last edited by dis1411; Mar 25th, 2003 at 12:19 AM.
-
Mar 25th, 2003, 06:26 AM
#3
Fanatic Member
I think I read somewhere that there's a checkbox in the EditBox's properties that checks to make sure everything entered is a number. Make sure that checkbox is not selected
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Mar 25th, 2003, 11:50 AM
#4
Thread Starter
Stuck in the 80s
Originally posted by dis1411
r u using UpdateData(TRUE) instead of UpdateData(FALSE)
also check to make sure the variable u have linked to it is string or cstring
Yes, I'm using UpdateData(TRUE), but I'm using float for the type? Can I not do that?
Originally posted by McCain
I think I read somewhere that there's a checkbox in the EditBox's properties that checks to make sure everything entered is a number. Make sure that checkbox is not selected
I can't find anything like it?
-
Mar 25th, 2003, 11:55 AM
#5
Thread Starter
Stuck in the 80s
Well, how can I convert a CString to a float?
-
Mar 25th, 2003, 12:10 PM
#6
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Mar 25th, 2003, 02:47 PM
#7
Thread Starter
Stuck in the 80s
How would I do that? This doesn't seem to work:
Code:
void CVGRTaxDlg::OnButtCalc() {
MyTax.SetTaxableIncome(atof(m_IncomeAmount));
m_iTaxAmount = MyTax.GetTaxAmount();
CVGRTaxDlg::OnChangeEditTax();
}
The application compiles but crashes.
-
Mar 25th, 2003, 04:20 PM
#8
Thread Starter
Stuck in the 80s
Nevermind. The crash was being caused elsewhere
Here's what I'm using:
Code:
MyTax.SetTaxableIncome(static_cast<float>(atof(m_IncomeAmount)));
And it works great. Thanks.
-
Mar 27th, 2003, 01:39 PM
#9
There are two additional options: an istringstream or the boost lexical_cast.
www.boost.org
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|