Click to See Complete Forum and Search --> : vc++.net TextBox
VaLDeZ++
August 8th, 2010, 05:07 PM
I am trying to implement a checkbox enabled textbox. I hit the backspace button to the beginning where there are no more characters left, and an error gets thrown. Im trying to use exception handling to eliminate the error but it is not working. This is the code i have:
private: System::Void textBox3_TextChanged(System::Object * sender, System::EventArgs * e)
{
labelboardsub->Text = String::Concat(S"Subtotal: $ ", (120. * Double::Parse(textBox3->Text)).ToString() );
double x;
try
{
x=this->textBox3->TextLength;
}
catch(FormatException *)
{
textBox3->TextLength==0;
}
}
Paul McKenzie
August 8th, 2010, 07:17 PM
I am trying to implement a checkbox enabled textbox. I hit the backspace button to the beginning where there are no more characters left, and an error gets thrown. Im trying to use exception handling to eliminate the error but it is not working. This is the code i have:
private: System::Void textBox3_TextChanged(System::Object * sender, System::EventArgs * e)Wrong forum. You want the Managed C++ forum to ask questions like this. The code you wrote is part of Managed C++, and this forum only deals with non-Managed VC++ libraries, code, and language syntax.
Regards,
Paul McKenzie
cilu
August 9th, 2010, 04:15 AM
[ redirected ]
cilu
August 9th, 2010, 04:17 AM
Where is the exception thrown from? If you don't know exactly, go to Debug > Exceptions and check "Common Language Runtime Exceptions" and then run your application in the debugger. It will stop at the line that throws.
Alex F
August 9th, 2010, 04:42 AM
Double:: Parse may throw exception if argument cannot be converted to double type. Catch this exception and handle it according to your requirements.
textBox3->TextLength - this line doesn't throw exception, you make exception handling in the wrong place.
mani3355
August 12th, 2010, 01:24 AM
hi,
trying to implement a checkbox enabled textbox. I hit the backspace button to the beginning where there are no more characters left, and an error gets thrown. Im trying to use exception handling to eliminate the error but it is not working.
regards,
phe9oxis,
http://www.guidebuddha.com
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.