|
-
August 8th, 2010, 05:07 PM
#1
vc++.net TextBox
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:
Code:
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;
}
}
-
August 8th, 2010, 07:17 PM
#2
Re: vc++.net TextBox
 Originally Posted by VaLDeZ++
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:
Code:
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
-
August 9th, 2010, 04:15 AM
#3
-
August 9th, 2010, 04:17 AM
#4
Re: vc++.net TextBox
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.
-
August 9th, 2010, 04:42 AM
#5
Re: vc++.net TextBox
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.
-
August 12th, 2010, 01:24 AM
#6
Re: vc++.net TextBox
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
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
|