Search code examples
c#visual-c++c++-clitryparse

How to use TryParse


when I try to use TryParse, its not working...

MyTxtBxStr="Something";
System::Decimal MyNumber1=0;
if (!Decimal::TryParse(MyTxtBxStr, MyNumber1)){
     MessageBox.Show("Invalid Value....Try Again");
}

It's giving the error like Syntax error C2143 missing ';' before '.'


Solution

  • Since it's C++, you must write

    MessageBox::Show("Invalid Value....Try Again");