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? :confused:
Printable View
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? :confused:
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
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
Yes, I'm using UpdateData(TRUE), but I'm using float for the type? Can I not do that?Quote:
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
I can't find anything like it?Quote:
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
Well, how can I convert a CString to a float?
Via atof.
How would I do that? This doesn't seem to work:
The application compiles but crashes.Code:void CVGRTaxDlg::OnButtCalc() {
MyTax.SetTaxableIncome(atof(m_IncomeAmount));
m_iTaxAmount = MyTax.GetTaxAmount();
CVGRTaxDlg::OnChangeEditTax();
}
Nevermind. The crash was being caused elsewhere :rolleyes:
Here's what I'm using:
And it works great. Thanks.Code:MyTax.SetTaxableIncome(static_cast<float>(atof(m_IncomeAmount)));
There are two additional options: an istringstream or the boost lexical_cast.
www.boost.org