CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2010
    Posts
    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;
    				
    					
    				}
    		 }

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: vc++.net TextBox

    Quote Originally Posted by VaLDeZ++ View Post
    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

  3. #3
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: vc++.net TextBox

    [ redirected ]
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  4. #4
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    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.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  5. #5
    Join Date
    Jul 2002
    Posts
    2,543

    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.

  6. #6
    Join Date
    Aug 2010
    Posts
    51

    Smile 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
  •  





Click Here to Expand Forum to Full Width

Featured